#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
int n;
string a, b;
cin >> n >> a >> b;
unordered_map<char, int> h1, h2;
for (int i = 0; i < n; i++) {
h1[a[i]] = h1[a[i]] + 1;
}
for (int i = 0; i < n; i++) {
h2[b[i]] = h2[b[i]] + 1;
}
int check = 0;
for (char c = 'a'; c <= 'z'; c++) {
if (h1[c] != h2[c]) {
check = 1;
break;
}
}
if (check == 1) {
cout << "Answer not possible." << endl;
} else {
int r = 0;
int i = n - 1;
int j = n - 1;
while (i >= 0 && j >= 0) {
if (a[i] == b[j]) {
r = r + 1;
i = i - 1;
j = j - 1;
} else {
i = i- 1;
}
}
cout << n - r << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dW5vcmRlcmVkX21hcD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKICAgIGludCBuOwogICAgc3RyaW5nIGEsIGI7CiAgICBjaW4gPj4gbiA+PiBhID4+IGI7CgogICAgdW5vcmRlcmVkX21hcDxjaGFyLCBpbnQ+IGgxLCBoMjsKCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGgxW2FbaV1dID0gaDFbYVtpXV0gKyAxOwogICAgfQoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgaDJbYltpXV0gPSBoMltiW2ldXSArIDE7CiAgICB9CgogICAgaW50IGNoZWNrID0gMDsKICAgIGZvciAoY2hhciBjID0gJ2EnOyBjIDw9ICd6JzsgYysrKSB7CiAgICAgICAgaWYgKGgxW2NdICE9IGgyW2NdKSB7CiAgICAgICAgICAgIGNoZWNrID0gMTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgfQoKICAgIGlmIChjaGVjayA9PSAxKSB7CiAgICAgICAgY291dCA8PCAiQW5zd2VyIG5vdCBwb3NzaWJsZS4iIDw8IGVuZGw7CiAgICB9IGVsc2UgewogICAgICAgIGludCByID0gMDsKICAgICAgICBpbnQgaSA9IG4gLSAxOwogICAgICAgIGludCBqID0gbiAtIDE7CiAgICAgICAgd2hpbGUgKGkgPj0gMCAmJiBqID49IDApIHsKICAgICAgICAgICAgaWYgKGFbaV0gPT0gYltqXSkgewogICAgICAgICAgICAgICAgciA9IHIgKyAxOwogICAgICAgICAgICAgICAgaSA9IGkgLSAxOwogICAgICAgICAgICAgICAgaiA9IGogLSAxOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgaSA9IGktIDE7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY291dCA8PCBuIC0gciA8PCBlbmRsOwogICAgfQoKICAgIHJldHVybiAwOwp9Cg==