I. Quantum Flips
time limit per test
8 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You work at a secret communications office, where every day you handle mysterious messages encoded in lowercase letters. One day, you receive two messages, both containing exactly the same number of letters. Your mission is to transform the first message $$$S$$$ into the second message $$$T$$$ using a very special operation.

The operation you can perform consists of two parts:

  1. Swap: Choose two distinct positions $$$i$$$ and $$$j$$$ in the message, and swap the letters at these positions.
  2. Quantum Flip: For every letter that lies strictly between positions $$$i$$$ and $$$j$$$ (i.e. from $$$\min(i, j) + 1$$$ to $$$\max(i, j) - 1$$$), change it to its complementary letter. The complementary letter is defined such that $$$\text{flip}(\text{'a'}) = \text{'z'}$$$, $$$\text{flip}(\text{'b'}) = \text{'y'}$$$, ..., $$$\text{flip}(\text{'z'}) = \text{'a'}$$$.

Note: If the chosen indices $$$i$$$ and $$$j$$$ are adjacent, the operation simply swaps the two letters, as there are no letters between them to flip.

Your goal is to determine the minimum number of operations required to transform $$$S$$$ into $$$T$$$. If it is impossible to transform $$$S$$$ into $$$T$$$ using these operations, output $$$-1$$$.

Input

The first line contains an integer $$$n$$$ ($$$2 \le n \le 7$$$) — the length of the strings.

The second line contains a string $$$S$$$ of length $$$n$$$, consisting of lowercase English letters.

The third line contains a string $$$T$$$ of length $$$n$$$, also consisting of lowercase English letters.

Output

Print a single integer: the minimum number of operations required to transform $$$S$$$ into $$$T$$$, or $$$-1$$$ if it is impossible.

Examples
Input
3
abc
xyz
Output
7
Input
6
codemi
meowic
Output
6
Input
3
cde
eyd
Output
-1
Note

Testcase 1: $$$$$$ \begin{array}{rcl} \texttt{abc} \xrightarrow{\text{1}} \texttt{cya} \xrightarrow{\text{2}} \texttt{yca} \xrightarrow{\text{3}} \texttt{axy} \xrightarrow{\text{4}} \texttt{xay} \xrightarrow{\text{5}} \texttt{yzx} \xrightarrow{\text{6}} \texttt{yxz} \xrightarrow{\text{7}} \texttt{xyz} \end{array}$$$$$$