Little Johnny has a very long surname, but he is not the only one. One of his kindergarten friends, Mary, has a surname of the same length. Her surname is different from Johnny's, yet it uses exactly the same letters with exactly the same multiplicities: the same number of A's, the same number of B's, and so on. In other words, one surname is an anagram of the other.
Johnny and Mary like to play a game. They take many small slips of paper and write the successive letters of Johnny's surname on them, one letter per slip laid out in a row. Then they repeatedly swap two neighbouring slips until the row spells Mary's surname.
Johnny wonders how few such swaps of adjacent letters are enough to turn his surname into Mary's. Write a program that, given both surnames, computes this minimum number of adjacent swaps.
The first line contains a single integer n (2≤n≤106), the length of each surname.
The second line contains Johnny's surname: a string of exactly n letters with no spaces.
The third line contains Mary's surname in the same format: a string of exactly n letters with no spaces.
Both strings consist only of uppercase letters of the English alphabet (A to Z), and each letter occurs the same number of times in both strings (they are anagrams of each other).
Print a single integer: the minimum number of swaps of two adjacent letters needed to transform Johnny's surname into Mary's.