Question
Complete Paint Strips

An artist paints a long strip using only three colors: a, b, and c.

A continuous part of the strip is called complete if it contains all three colors at least once.

You are given the final painted strip. Count the number of complete continuous parts.

Input

The first line contains a single integer KaTeX can only parse string typed expression — the length of the strip.

The second line contains a string KaTeX can only parse string typed expression of length KaTeX can only parse string typed expression, consisting only of characters KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression.

Output

Print a single integer — the number of substrings that contain all three colors at least once.

Example
Input
6

abacbc
Output
8
Explanation

For starting position KaTeX can only parse string typed expression, the shortest complete substring ends at position KaTeX can only parse string typed expression, so there are KaTeX can only parse string typed expression valid endings.

For starting position KaTeX can only parse string typed expression, the shortest complete substring also ends at position KaTeX can only parse string typed expression, so there are KaTeX can only parse string typed expression valid endings.

For starting position KaTeX can only parse string typed expression, the shortest complete substring ends at position KaTeX can only parse string typed expression, so there are KaTeX can only parse string typed expression valid endings.

Total complete substrings are KaTeX can only parse string typed expression.

Online