While Melman sat in a narrow box and floated somewhere, he was very bored. To entertain himself, he started playing a game with coins he found in the box.
He put the coins in front of him in a row and numbered them from to from left to right. Some coins are heads up, and some are tails up. Then, Melman starts making moves. First, he counts the number — the number of coins that are heads up. If there are no such coins, then the game ends. Otherwise, he makes a move: flips the coin number .
Help Melman determine how many moves he will have to make to finish the game, given the initial position of the coins. Or say that the game will continue indefinitely.
The first line contains one integer (1 \le n \le 10^5) — the number of coins.
The second line contains a string of characters, each either "0" or "1", representing the initial state of the coins. The character "0" corresponds to a coin lying tails up, and the character "1" to heads up.
If the game will continue indefinitely, print "-1". Otherwise, print the number of moves Melman has to make before the game ends.
Example 1
Example 2
Example 3
Example 4