def main():
    N = int(input())
    S = set(map(int, input().split()))
    Q = int(input())
    T = set(map(int, input().split()))

    cnt = 0
    for i in T:
        if i in S:
            cnt += 1

    print(cnt)

main() def main():
    N = int(input())
    S = set(map(int, input().split()))
    Q = int(input())
    T = set(map(int, input().split()))

    cnt = 0
    for i in T:
        if i in S:
            cnt += 1

    print(cnt) main N = int(input()) 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 Q = int(input()) Q 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 cnt = 0 cnt 0 for i in T:
        if i in S:
            cnt += 1

     i T if i in S:
            cnt += 1

     i in S i S cnt += 1 cnt 1 print(cnt) print cnt main() main def main():
    N = int(input())
    S = set(map(int, input().split()))
    Q = int(input())
    T = set(map(int, input().split()))

    cnt = 0
    for i in T:
        if i in S:
            cnt += 1

    print(cnt) def main():
    N = int(input())
    S = set(map(int, input().split()))
    Q = int(input())
    T = set(map(int, input().split()))

    cnt = 0
    for i in T:
        if i in S:
            cnt += 1

    print(cnt) main
def main():
    N = int(input())
    S = set(map(int, input().split()))
    Q = int(input())
    T = set(map(int, input().split()))

    cnt = 0
    for i in T:
        if i in S:
            cnt += 1

    print(cnt)

main()