Use the which() function to calculate the position of the first person that is not allowed to enter the elevator.