The countdown to the Olympic and Paralympic Games Tokyo 2020
continues until summer 2021. That aside, you are asked to
count up the occurrences of the four integers
2, 0, 2, and 0
appearing consecutively in this order
in given lists of integers.
The input consists of multiple datasets, each in the following format.
n
d1 … dn
Each of the datasets consists of two lines. The first line has an
integer n (4 ≤ n ≤ 1000), which is the number of
integers listed in the second line. The second line
contains n integers
d1, …, dn
separated by spaces.
Here, all of d1 to dn are
between 0 and 9, inclusive.
The end of the input is indicated by a line containing a zero.
The number of datasets does not exceed 100.
For each of the datasets, output one line containing the
number of times the four integers
2, 0, 2, and 0
appear consecutively in this order in the list of integers in its second line.
Overlapping occurrences are separately counted.
“2 0 2 0 2 0 2 0”, for example, is said to have
three occurrences, rather than two.