def main(): _ = map(int, input().split()) s = input() t = input() ans = min(s.count("A"), t.count("A")) + min(s.count("B"), t.count("B")) print(ans) if __name__ == "__main__": main()