def linear_search(search_list, target):
    i = 0
    search_list.append(target)
    while search_list[i] != target:
        i += 1
    if i == len(search_list) - 1:
        return -1
    else:
        return i

if __name__ == '__main__':
    n = int(input())
    S = [int(x) for x in input().split()]
    q = int(input())
    T = [int(x) for x in input().split()]
    count = 0

    for x in T:
        if linear_search(S, x) > -1:
            count += 1
    print(count) def linear_search(search_list, target):
    i = 0
    search_list.append(target)
    while search_list[i] != target:
        i += 1
    if i == len(search_list) - 1:
        return -1
    else:
        return i linear_search i = 0 i 0 search_list.append(target) search_list.append search_list append target while search_list[i] != target:
        i += 1
     search_list[i] != target search_list[i] search_list i target i += 1 i 1 if i == len(search_list) - 1:
        return -1
    else:
        return i i == len(search_list) - 1 i len(search_list) - 1 len(search_list) len search_list 1 return -1 -1 return i i search_list search_list target target if __name__ == '__main__':
    n = int(input())
    S = [int(x) for x in input().split()]
    q = int(input())
    T = [int(x) for x in input().split()]
    count = 0

    for x in T:
        if linear_search(S, x) > -1:
            count += 1
    print(count) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x S = [int(x) for x in input().split()] S [int(x) for x in input().split()] q = int(input()) q int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x T = [int(x) for x in input().split()] T [int(x) for x in input().split()] count = 0 count 0 for x in T:
        if linear_search(S, x) > -1:
            count += 1
     x T if linear_search(S, x) > -1:
            count += 1
     linear_search(S, x) > -1 linear_search(S, x) linear_search S x -1 count += 1 count 1 print(count) print count S = [int(x) for x in input().split()] [int(x) for x in input().split()] S count = 0 0 count def linear_search(search_list, target):
    i = 0
    search_list.append(target)
    while search_list[i] != target:
        i += 1
    if i == len(search_list) - 1:
        return -1
    else:
        return i def linear_search(search_list, target):
    i = 0
    search_list.append(target)
    while search_list[i] != target:
        i += 1
    if i == len(search_list) - 1:
        return -1
    else:
        return i linear_search T = [int(x) for x in input().split()] [int(x) for x in input().split()] T q = int(input()) int(input()) q n = int(input()) int(input()) n count += 1 1 count
def linear_search(search_list, target):
    i = 0
    search_list.append(target)
    while search_list[i] != target:
        i += 1
    if i == len(search_list) - 1:
        return -1
    else:
        return i

if __name__ == '__main__':
    n = int(input())
    S = [int(x) for x in input().split()]
    q = int(input())
    T = [int(x) for x in input().split()]
    count = 0

    for x in T:
        if linear_search(S, x) > -1:
            count += 1
    print(count)
