def main():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = list(map(int,input().split()))

    cnt = 0
    S.sort()
    for i in range(n):
        if i == 0:
            if S[i] in T:
                cnt += 1
                continue
        if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

    return cnt

print(main())
 def main():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = list(map(int,input().split()))

    cnt = 0
    S.sort()
    for i in range(n):
        if i == 0:
            if S[i] in T:
                cnt += 1
                continue
        if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

    return cnt main n = int(input()) n int(input()) int input() input S = list(map(int,input().split())) S list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split q = int(input()) q int(input()) int input() input T = list(map(int,input().split())) T list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split cnt = 0 cnt 0 S.sort() S.sort S sort for i in range(n):
        if i == 0:
            if S[i] in T:
                cnt += 1
                continue
        if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

     i range(n) range n if i == 0:
            if S[i] in T:
                cnt += 1
                continue
         i == 0 i 0 if S[i] in T:
                cnt += 1
                continue
         S[i] in T S[i] S i T cnt += 1 cnt 1 continue if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

     (S[i] in T) and (S[i] != S[i-1]) S[i] in T S[i] S i T S[i] != S[i-1] S[i] S i S[i-1] S i-1 i 1 cnt += 1 cnt 1 return cnt cnt print(main()) print main() main def main():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = list(map(int,input().split()))

    cnt = 0
    S.sort()
    for i in range(n):
        if i == 0:
            if S[i] in T:
                cnt += 1
                continue
        if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

    return cnt def main():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = list(map(int,input().split()))

    cnt = 0
    S.sort()
    for i in range(n):
        if i == 0:
            if S[i] in T:
                cnt += 1
                continue
        if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

    return cnt main
def main():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = list(map(int,input().split()))

    cnt = 0
    S.sort()
    for i in range(n):
        if i == 0:
            if S[i] in T:
                cnt += 1
                continue
        if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

    return cnt

print(main())

