def main():
    m = int(input())
    a = set(map(int, input().split()))
    n = int(input())
    b = set(map(int, input().split()))
    print(len(a & b))


if __name__ == "__main__":
    main()
 def main():
    m = int(input())
    a = set(map(int, input().split()))
    n = int(input())
    b = set(map(int, input().split()))
    print(len(a & b)) main m = int(input()) m int(input()) int input() input a = set(map(int, input().split())) a set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split n = int(input()) n int(input()) int input() input b = set(map(int, input().split())) b set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split print(len(a & b)) print len(a & b) len a & b a b if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    m = int(input())
    a = set(map(int, input().split()))
    n = int(input())
    b = set(map(int, input().split()))
    print(len(a & b)) def main():
    m = int(input())
    a = set(map(int, input().split()))
    n = int(input())
    b = set(map(int, input().split()))
    print(len(a & b)) main
def main():
    m = int(input())
    a = set(map(int, input().split()))
    n = int(input())
    b = set(map(int, input().split()))
    print(len(a & b))


if __name__ == "__main__":
    main()

