A string is considered a prefix of a string if A = PB, where either or can be empty. A string is a non-trivial prefix of if A = PB, and neither nor are empty. A string is termed a period of the string if is a non-trivial prefix of and is a prefix (though not necessarily a non-trivial one) of the string . For instance, the strings abab and ababab are periods of the string abababa.
The maximum period of a string is the longest among its periods, or an empty string if has no periods. For example, the maximum period of the string ababab is abab, and the maximum period of the string abc is an empty string.
Write a program that calculates the sum of the lengths of the maximum periods for all prefixes of the given string .
The first line of the input contains a single integer (1 \le k \le 1000000) – the length of the string . The second line contains a sequence of lowercase letters from the English alphabet – the string .
Output a single integer on one line – the sum of the lengths of the maximum periods of each prefix of the string .
Example 1