Counting the number of pages