count outside the loop