时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Bobo has a string

of length n consisting of only digits 0, 1, and 2, and he wants to pick some *disjoint* subsequences which equal to 2020, as many as possible.
Formally, Bobo would like to find k quadrangle
%2C%20%5Cdots%2C%20(a_k%2C%20b_k%2C%20c_k%2C%20d_k))
where
*

*

*

for

.
Find the maximum value of k.
输入描述:
The input consists of several test cases terminated by end-of-file.
The first line of each test case contains an integer n and the second line contains a string
.
* 
* 
* The sum of n does not exceed
.
输出描述:
For each test case, print an integer which denotes the result.
示例1
输入
复制
4
2222
7
2101210
8
22002200