def resolve():
    N = int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    ans = 0
    # S.append(-1)
    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
    print(ans)


resolve() def resolve():
    N = int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    ans = 0
    # S.append(-1)
    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
    print(ans) resolve N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i S = [int(i) for i in input().split()] S [int(i) for i in input().split()] int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i T = [int(i) for i in input().split()] T [int(i) for i in input().split()] ans = 0 ans 0 for t in T:
        for s in S:
            if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
     t T for s in S:
            if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
     s S if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
     s == t s t ans += 1 ans 1 break print(ans) print ans resolve() resolve def resolve():
    N = int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    ans = 0
    # S.append(-1)
    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
    print(ans) def resolve():
    N = int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    ans = 0
    # S.append(-1)
    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
    print(ans) resolve
def resolve():
    N = int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    ans = 0
    # S.append(-1)
    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break
        # i = 0
        # S[N] = t
        # while S[i] != t:
        #     i += 1
        # if i != N:
        #     ans += 1
    print(ans)


resolve()
