Help using If statements (ithink)

Sorry I will try and be more clear.

The project is a counter for a door. 1 button counts in, the other out. If there are less the 9 people in the building then the relay will go high and open the door. if the counter is at 9 (the limit), the relay doesn't go high and doesn't open the door.

I hope this make sense. Do I need to store the number state within a INT and then run an IF/Else from that?