input() S = input() T = input() ans = 0 for C in 'AB': ans += min(S.count(C), T.count(C)) print(ans)