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

    count = 0
    for t in T:
        if t in S:
            count += 1

    print(count)


if __name__ == "__main__":
    main() def main():
    int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    count = 0
    for t in T:
        if t in S:
            count += 1

    print(count) main 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()] count = 0 count 0 for t in T:
        if t in S:
            count += 1

     t T if t in S:
            count += 1

     t in S t S count += 1 count 1 print(count) print count if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    count = 0
    for t in T:
        if t in S:
            count += 1

    print(count) def main():
    int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    count = 0
    for t in T:
        if t in S:
            count += 1

    print(count) main
def main():
    int(input())
    S = [int(i) for i in input().split()]
    int(input())
    T = [int(i) for i in input().split()]

    count = 0
    for t in T:
        if t in S:
            count += 1

    print(count)


if __name__ == "__main__":
    main()
