Problem Jurassic Park

This problem code is NI01
Problem Link http://www.codechef.com/problems/NI01
I can’t figure out a way to count the number of cars which will be available after each time frame of safari riding?

please help…