Public Judge

pjudge

时间限制: 1 s 内存限制: 1024 MB 总分: 100 可 Hack ✓
统计

At Huahua University, students need to attend classes in $n$ classrooms in a specific order. The $i$-th classroom has an attribute $s_i \in \{0, 1\}$. If $s_i = 1$, it means there is a coffee machine in this classroom; if $s_i = 0$, there is no coffee machine.

You are a student at Huahua University. In a classroom with a coffee machine, you can drink a cup of coffee to stay awake. Specifically, after leaving a classroom with a coffee machine, you can carry at most two cups of coffee (one in each hand) to the next classroom, so that even if that classroom does not have a coffee machine, you can stay awake by drinking the coffee you are carrying.

Now you want to know the maximum number of classrooms in which you can drink coffee.

Input

The first line of input contains an integer $n$.

The next line contains a string $s$ of length $n$, consisting only of characters '0' and '1', where the $i$-th character $s_i$ describes whether the $i$-th classroom has a coffee machine.

Output

Output a single integer representing the answer.

Subtasks

For $100\%$ of the data, $1 \le n \le 10^5$.

Test Case ID $n\le $
$1$ $1$
$2 \sim 6$ $10$
$7 \sim 8$ $5\,000$
$9 \sim 20$ $10^5$

Examples

Input 1

6
010100

Output 1

5

Input 2

10
0000000110

Output 2

3

Input 3

See the provided files.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.