def linearSearch(S, T):
    cnt = 0
    for e in T:
        if e in S:
            cnt += 1
    return cnt


def main():
    n = int(input())
    s = list(map(int, input().split()))
    q = int(input())
    t = list(map(int, input().split()))

    print(linearSearch(s, t))

if __name__ == "__main__":
    main() def linearSearch(S, T):
    cnt = 0
    for e in T:
        if e in S:
            cnt += 1
    return cnt linearSearch cnt = 0 cnt 0 for e in T:
        if e in S:
            cnt += 1
     e T if e in S:
            cnt += 1
     e in S e S cnt += 1 cnt 1 return cnt cnt S S T T def main():
    n = int(input())
    s = list(map(int, input().split()))
    q = int(input())
    t = list(map(int, input().split()))

    print(linearSearch(s, t)) 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 print(linearSearch(s, t)) print linearSearch(s, t) linearSearch s t if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def linearSearch(S, T):
    cnt = 0
    for e in T:
        if e in S:
            cnt += 1
    return cnt def linearSearch(S, T):
    cnt = 0
    for e in T:
        if e in S:
            cnt += 1
    return cnt linearSearch def main():
    n = int(input())
    s = list(map(int, input().split()))
    q = int(input())
    t = list(map(int, input().split()))

    print(linearSearch(s, t)) def main():
    n = int(input())
    s = list(map(int, input().split()))
    q = int(input())
    t = list(map(int, input().split()))

    print(linearSearch(s, t)) main
def linearSearch(S, T):
    cnt = 0
    for e in T:
        if e in S:
            cnt += 1
    return cnt


def main():
    n = int(input())
    s = list(map(int, input().split()))
    q = int(input())
    t = list(map(int, input().split()))

    print(linearSearch(s, t))

if __name__ == "__main__":
    main()