This problem is a LOT more complicated than it appears.
The issues aren't about circuits...they're about people.
The solution linked elsewhere in the thread alludes
to the kinds of issues you get when two people enter
the detection zone simultaneously. If you're willing to
restrict traffic flow to enforce one person not loitering
in the detection zone, it gets easier.
As always, the devil is in the details. If you are building
a commercial device to be replicated, it'd better work well.
If it's a toy project or a school project, I'd take the easy
way out.
Build yourself an oscillator with 25% duty factor.
Drive two IR leds out of phase.
Use two front-surface mirrors to deflect the two beams
onto the IR port of a Palm III. Let the palm sort out
which beam is broken and in which order. Display the
count on the screen.
If you just want to know if the room is occupied,
PIR sensors might be the way to go.
Or you could just put a coin box on each side and make
people deposit a token to get in our out...Count those.
All depends on what you're trying to accomplish.