#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Linear Search
n ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????
T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°????????????????????????????????????
"""

def main():
    """ ????????? """
    n = int(input())
    S = list(input().split())
    q = int(input())
    T = list(input().split())

    cnt = {}
    for i in range(n):
        for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
    print(len(cnt))


if __name__ == '__main__':
    main() """
Linear Search
n ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????
T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°????????????????????????????????????
""" def main():
    """ ????????? """
    n = int(input())
    S = list(input().split())
    q = int(input())
    T = list(input().split())

    cnt = {}
    for i in range(n):
        for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
    print(len(cnt)) main """ ????????? """ n = int(input()) n int(input()) int input() input S = list(input().split()) S list(input().split()) list input().split() ().split () input split q = int(input()) q int(input()) int input() input T = list(input().split()) T list(input().split()) list input().split() ().split () input split cnt = {} cnt {} for i in range(n):
        for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
     i range(n) range n for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
     j range(q) range q if S[i] == T[j]:
                cnt[T[j]] = 1
                break
     S[i] == T[j] S[i] S i T[j] T j cnt[T[j]] = 1 cnt[T[j]] cnt T[j] T j 1 break print(len(cnt)) print len(cnt) len cnt if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    """ ????????? """
    n = int(input())
    S = list(input().split())
    q = int(input())
    T = list(input().split())

    cnt = {}
    for i in range(n):
        for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
    print(len(cnt)) def main():
    """ ????????? """
    n = int(input())
    S = list(input().split())
    q = int(input())
    T = list(input().split())

    cnt = {}
    for i in range(n):
        for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
    print(len(cnt)) main
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Linear Search
n ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????
T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°????????????????????????????????????
"""

def main():
    """ ????????? """
    n = int(input())
    S = list(input().split())
    q = int(input())
    T = list(input().split())

    cnt = {}
    for i in range(n):
        for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
    print(len(cnt))


if __name__ == '__main__':
    main()