482. Minimum Moves to Make Palindrome

0

Hard

Given a string s consisting only of lowercase English letters, determine the minimum number of moves needed to make s a palindrome. In one move, you can select any two adjacent characters of s and swap them. The input will be generated such that s can always be converted to a palindrome.

Input Format

The first line contains a single integer N, the length of the string. The next line contains the string s.

Output Format

An integer representing the minimum number of moves to make the string palindrome.

Example

Input

4 aabb

Output

2

Constraints

1 <= N <= 2*10^3
Loading...

View Submissions

Console