How to restart a level only for 2 times?

Hey, I’m kinda new to unity, I am currently working a 2d quiz game. I almost finished the game but I found a problem, that If I answer a question wrongly the scene has been reloading again and again till the answer is correct. But I want to give only 2 changes to restart that level and If the answer is incorrect in these two chances then go back to the main page. But I don’t know how to set that. It would be nice if anyone help me with this, Thanks.!

You can do this by having a Singleton class and storing the count there. When you go back to the main page reset the count to 0 and each time you load the quiz bump the count and don’t allow it to run again if the count is > 2.