detect how many people are entering/leaving home using yun

Plan D: PIR Motion Sensor

PIR Motion Sensor is A passive infrared sensor is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view.

Plan E: Turn your Pi (or Arduino) into a low-cost HD surveillance cam

http://www.raspberrypi.org/archives/5071

The heart of system is software motion which does exist at linino, but unfortunately up stream OS openwrt broken the support ffmpeg at motion. wait Arduino TRE is best bet ( or compile motion yourself). The motion will alert you via text message or web service of image or video which allow you view via internet.