The ghost Adi trains hard for the programming contest Ghostcoder. Every contest has exactly 2 problems to solve, so a contest result is the number of solved problems, which is one of 0, 1, 2.
Adi carefully writes down the results of the contests in order. Now he wants to show off his growth to his friends. That is, he wants to pick some of the recorded results, keeping them in contest order, so that the chart drawn by the picked results never goes down (each picked result is not smaller than the one picked right before it), while making the number of picked results as large as possible.
Given the record of contest results, find the maximum length of such a chart that Adi can obtain.
The first line contains the number of contests Adi took part in, n (1≤n≤106).
The second line contains n integers, the results of Adi's contests in order, separated by spaces. Each result is one of 0, 1, 2.
Print one integer: the length of the longest score chart Adi can obtain that never decreases. Here, the chart never decreasing means that, listing the picked results in contest order, each result is greater than or equal to the one right before it.