Energy Tycoon

No attempts yetTime limit2sMemory limit256 MB

Problem

Vasya is playing a turn-based strategy game called Energy Tycoon.

The rules are simple.

  • The board has nn slots in a row.
  • A power plant occupies one or two consecutive slots and produces one unit of energy.
  • Every turn the game offers one new power plant, and you can place it on the board if you want to. If there is no room for it, you can remove any of the plants you built earlier.
  • At the end of every turn, the game adds the energy produced by the plants standing on the board to the total score.

Vasya already knows which power plant he can build on each turn. What is the largest total score he can reach?

Input

The first line contains the number of slots nn (1n1000001 \le n \le 100000).

The second line contains a string ss. If the ii-th character of ss is 1, you can build a one-slot power plant on turn ii, and if it is 2, you can build a two-slot power plant on turn ii. The number of turns does not exceed 100000.

Output

Print the largest total score that can be achieved.