AT_abc399_e [ABC399E] Replace

Description

You are given a positive integer $ N $ and two strings $ S $ and $ T $ , each of length $ N $ and consisting of lowercase English letters. Determine whether it is possible to make $ S $ identical to $ T $ by repeating the operation below any number of times (possibly zero). If it is possible, also find the minimum number of operations required. - Choose two lowercase English letters $ x, y $ and replace **every** occurrence of $ x $ in $ S $ with $ y $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ S $ $ T $

Output Format

If it is possible to make $ S $ identical to $ T $ , print the minimum number of operations required. Otherwise, print $ -1 $ .

Explanation/Hint

### Sample Explanation 1 By performing the operation four times in the following way, you can make $ S $ identical to $ T $ : 1. Choose $ x= $ `b` and $ y= $ `c`. $ S $ becomes `afcfda`. 2. Choose $ x= $ `a` and $ y= $ `b`. $ S $ becomes `bfcfdb`. 3. Choose $ x= $ `f` and $ y= $ `k`. $ S $ becomes `bkckdb`. 4. Choose $ x= $ `d` and $ y= $ `b`. $ S $ becomes `bkckbb`, which is identical to $ T $ . It cannot be done with fewer than four operations, so the minimum number of operations required is $ 4 $ . ### Sample Explanation 2 $ S $ and $ T $ are already identical, so no operations are required. ### Sample Explanation 3 No matter how you repeat the operation, it is impossible to make $ S $ identical to $ T $ . ### Constraints - $ 1\leq N \leq 2\times 10^5 $ - $ N $ is an integer. - Each of $ S $ and $ T $ is a string of length $ N $ , consisting of lowercase English letters.