Apples, pineapples, and pens are lined up in a row. You may group four consecutive objects without changing their order. Four objects count as one group only when they appear in the order pen, pineapple, apple, pen. One pen can belong to at most one group. The order pen, apple, pineapple, pen does not count as a group.
Input
The first line gives the total number of objects n (1≤n≤1000000).
The second line gives the list of objects as a string of length n. An apple is written as A, a pineapple as P, and a pen as p, distinguishing uppercase and lowercase.
Output
Print the maximum number of groups that can be made.