His formula holds true for several months until one night when he counts 1 extra person leaving in the evening. The security guard is confused for a moment but then finds out that one of the employees brought his daughter to work with him. The little girl was not counted when she came in.
Another time, the security guard finds that three people are missing at the end of the day. He scours the building and can not find anyone. He checks all the offices and meeting rooms, but they are all empty. As a last resort, he checks the videotape from the security camera. He finds that around lunchtime, three of the employees sneaked out without him noticing and never came back. They account for the three missing people.
The little girl and three employees that sneaked out are examples of situations in which the security guard had no control. There is an outside influence changing his head count and his formula for the total number of people going out of the building is no longer accurate. His count is incorrect because he was unable to detect the little girl and the three employees. If he is more careful and finds better ways to detect the people, like using the videotape, his count will be correct. When the count is not affected by some outside influence and the security guard knows how to account for where everyone is, the number of people counted by the security guard in a day stays the same.