DNA Discovery

Time limit1sMemory limit128 MB

Problem

Biologists discovered an unusual DNA molecule they had never seen before. The molecule can be represented as a length-N string consisting only of the characters A and B. After several mutations, it can become a molecule whose characters are all A.

The researchers found that only two types of mutation are possible.

  1. Choose one character in the molecule and change it to the other character. (A becomes B, and B becomes A.)
  2. Choose a length K, then change all of the first K characters to the other character.

Given the DNA molecule, find the minimum number of mutations needed to make every character A.

Input

The first line contains the length N of the molecule. (1 ≤ N ≤ 1,000,000)

The second line contains the length-N string consisting only of A and B.

Output

Print the minimum number of mutations needed to make every character A.