AIOC Banner

Problem: Cute Numbers

Want to try solving this problem? You can submit your code online if you log in or register.


Cute Numbers

Input File: cutein.txt
Output File: cuteout.txt
Time Limit: 1 second

For you, numbers have personalities. The number 4 is elegant, 18 is strong and 42 is enigmatic. And, of course, any number ending in 0 is cute.

The more zeroes at the end of a number, the cuter that number is. Therefore 70, 36640 and 1800090 are only a little bit cute (ending in just one zero), whereas 400 and 99200 are very cute (ending in two zeroes) and 30000 is really really cute (ending in four zeroes).

Your task is to read in a number N and determine how many zeroes are at the end of that number, so you can tell just how cute the number is.

Input

The first line of input will consist of the single integer d, telling you how many digits are in the number N. You are guaranteed that 1 <= d <= 100,000.

Following this will be d additional lines, each containing a single digit (0, 1, 2, 3, 4, 5, 6, 7, 8 or 9). These will be the digits of N, written from left to right. You are guaranteed that the first digit of N will not be zero.

Output

You must write a single integer as output, representing the number of zeroes at the end of N.

Sample Input 1

5
9
9
2
0
0

Sample Output 1

2

Sample Input 2

7
1
8
0
0
0
9
0

Sample Output 2

1

Explanation

The first example describes N = 99200, which ends in two zeroes. The second example describes N = 1800090, which contains many zeroes within but has only one zero at the end.

Scoring

The score for each input file will be 100% if the correct answer is written to the output file and 0% otherwise.

 


Privacy statement
© Australian Mathematics Trust 2001-2019

Contact: training@orac.amt.edu.au
Page generated: 26 August 2019,  4:14am AEST