using optical gates to count how many peapole are in a room with(b83609)

Tanks DrDiettrich!
For the sugeston but is there a way to make the code so if someone there was a person in the room but left that the relay only turns of whena cearin time has pased