i=input i() s=i().count t=i().count print(sum(min(s(c),t(c))for c in'AB'))