def run():
    s_n = int(input())
    S = set(map(int, input().split()))
    t_n = int(input())
    T = set(map(int, input().split()))

    print(len(S&T))

if __name__ == '__main__':
    run()

 def run():
    s_n = int(input())
    S = set(map(int, input().split()))
    t_n = int(input())
    T = set(map(int, input().split()))

    print(len(S&T)) run s_n = int(input()) s_n int(input()) int input() input S = set(map(int, input().split())) S set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split t_n = int(input()) t_n int(input()) int input() input T = set(map(int, input().split())) T set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split print(len(S&T)) print len(S&T) len S&T S T if __name__ == '__main__':
    run() __name__ == '__main__' __name__ '__main__' run() run def run():
    s_n = int(input())
    S = set(map(int, input().split()))
    t_n = int(input())
    T = set(map(int, input().split()))

    print(len(S&T)) def run():
    s_n = int(input())
    S = set(map(int, input().split()))
    t_n = int(input())
    T = set(map(int, input().split()))

    print(len(S&T)) run
def run():
    s_n = int(input())
    S = set(map(int, input().split()))
    t_n = int(input())
    T = set(map(int, input().split()))

    print(len(S&T))

if __name__ == '__main__':
    run()


