Using a loop to count