Dancing school#160

Dancing school

1 second
128 megabytes
Medium

Professor Arkan's ballroom dance school has enrolled students—boys and girls. The professor lines them up in a single row and wants to select a group of consecutive students for the first lesson such that the number of boys and girls in the group is equal. How many ways can the professor choose such a group?

Input

The first line contains an integer (1 \leq n \leq 10^6). The second line contains a string of characters, each either (representing a girl) or (representing a boy).

Output

Print a single integer—the number of ways to choose a group in which the number of boys and girls is equal.

Examples

Example 1

Loading
Loading