def main():
    N = int(input())
    S = [int(_) for _ in input().split()]
    Q = int(input())
    T = [int(_) for _ in input().split()]

    ans = 0

    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break

    print(ans)

main()
 def main():
    N = int(input())
    S = [int(_) for _ in input().split()]
    Q = int(input())
    T = [int(_) for _ in input().split()]

    ans = 0

    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break

    print(ans) main N = int(input()) N int(input()) int input() input int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ S = [int(_) for _ in input().split()] S [int(_) for _ in input().split()] Q = int(input()) Q int(input()) int input() input int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ T = [int(_) for _ in input().split()] T [int(_) for _ in input().split()] ans = 0 ans 0 for t in T:
        for s in S:
            if s == t:
                ans += 1
                break

     t T for s in S:
            if s == t:
                ans += 1
                break

     s S if s == t:
                ans += 1
                break

     s == t s t ans += 1 ans 1 break print(ans) print ans main() main def main():
    N = int(input())
    S = [int(_) for _ in input().split()]
    Q = int(input())
    T = [int(_) for _ in input().split()]

    ans = 0

    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break

    print(ans) def main():
    N = int(input())
    S = [int(_) for _ in input().split()]
    Q = int(input())
    T = [int(_) for _ in input().split()]

    ans = 0

    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break

    print(ans) main
def main():
    N = int(input())
    S = [int(_) for _ in input().split()]
    Q = int(input())
    T = [int(_) for _ in input().split()]

    ans = 0

    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break

    print(ans)

main()

