#include <stdio.h>
#include <stdbool.h>
#define FOR(i, n) for (int i=0; i<n; i++)
int lg[(1 << 15) + 1]; // I'm too lazy to do this properly
void run(void) {
int n;
char aa[17], bb[17];
int a[16], b[16];
scanf("%d %s %s", &n
, aa
, bb
); FOR(i, n)
a[i] = aa[i] - 'a', b[i] = bb[i] - 'a';
int mask = 0; // current bitmask
int cha[26], chb[26]; // count # of each character for the current mask
FOR(i, 26)
cha[i] = chb[i] = 0;
int cnta = 0, cntb = 0; // count # of distinct characters
#define ADD(chx, cntx, c) (cntx += !(chx[c]++))
#define DEL(chx, cntx, c) (cntx -= !(--chx[c]))
FOR(i, n)
ADD(cha, cnta, a[i]), ADD(chb, cntb, b[i]);
int res = (cnta < cntb) ? cntb : cnta;
for (int i=1; i < 1<<n; i++) {
int lbit = i & (-i); // the least significant bit
int pos = lg[lbit];
mask ^= lbit;
if (mask & lbit) {// we have just switched it on, i. e. we swap a[i] and b[i]
ADD(cha, cnta, b[pos]), DEL(cha, cnta, a[pos]);
ADD(chb, cntb, a[pos]), DEL(chb, cntb, b[pos]);
} else {
ADD(cha, cnta, a[pos]), DEL(cha, cnta, b[pos]);
ADD(chb, cntb, b[pos]), DEL(chb, cntb, a[pos]);
}
int max = (cnta > cntb) ? cnta : cntb;
res = (res < max) ? res : max;
}
}
int main(void) {
FOR(i, 16)
lg[1 << i] = i;
int t;
while (t--)
run();
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRib29sLmg+CiAKI2RlZmluZSBGT1IoaSwgbikgZm9yIChpbnQgaT0wOyBpPG47IGkrKykKaW50IGxnWygxIDw8IDE1KSArIDFdOyAvLyBJJ20gdG9vIGxhenkgdG8gZG8gdGhpcyBwcm9wZXJseQogCnZvaWQgcnVuKHZvaWQpIHsKCWludCBuOwoJY2hhciBhYVsxN10sIGJiWzE3XTsKCWludCBhWzE2XSwgYlsxNl07CglzY2FuZigiJWQgJXMgJXMiLCAmbiwgYWEsIGJiKTsKC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