What you're asking is much more complex than you might think, there is no single sensor (aside from possible RFID tracking) that would work, and that's not particularly simple.
There are so many factors that can make IR beam breaking as a person in room count to be wrong or misread such as with pets or two persons traveling very close to one another, or even ambient light issues.
If you do some searches on your own using Google you'll see many references to people getting frustrated with the inaccuracies of these kinds of IR based systems.
To start with you could use a IR laser sender/receiver (possibly modulated to avoid ambient IR but a laser is so strong it may not be needed) but it would have to use multiple beams or have reflectors at the doorways in order to create a 'screen' so that regardless of where an object enter high or low it would trip the detector the reflector screen is probably your best bet but optically this is not easy to implement. This would have to be done in every doorway in the house and it would have to be unobstructed by any doors.
Just as an example the biggest fault of this type of system would be someone standing in the doorway while another person passed through it.