#! /usr/bin/env python
# -*- coding: utf-8 -*-

''' ?????¢??¢?´¢ '''

# n??????????´??????????????????????q????????¢?´¢????????£?????´???
# ?¨??????????O(qn)


def linear_search(S, T):
    count = 0
    for t in T:
        if t in S:
            count += 1
    return count

if __name__ == '__main__':
    NS = int(input())
    S = list(map(int, input().split()))
    NT = int(input())
    T = list(map(int, input().split()))

    print(linear_search(S, T)) ''' ?????¢??¢?´¢ ''' def linear_search(S, T):
    count = 0
    for t in T:
        if t in S:
            count += 1
    return count linear_search 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 return count count S S T T if __name__ == '__main__':
    NS = int(input())
    S = list(map(int, input().split()))
    NT = int(input())
    T = list(map(int, input().split()))

    print(linear_search(S, T)) __name__ == '__main__' __name__ '__main__' NS = int(input()) NS 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 NT = int(input()) NT 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(linear_search(S, T)) print linear_search(S, T) linear_search S T NS = int(input()) int(input()) NS NT = int(input()) int(input()) NT T = list(map(int, input().split())) list(map(int, input().split())) T def linear_search(S, T):
    count = 0
    for t in T:
        if t in S:
            count += 1
    return count def linear_search(S, T):
    count = 0
    for t in T:
        if t in S:
            count += 1
    return count linear_search S = list(map(int, input().split())) list(map(int, input().split())) S
#! /usr/bin/env python
# -*- coding: utf-8 -*-

''' ?????¢??¢?´¢ '''

# n??????????´??????????????????????q????????¢?´¢????????£?????´???
# ?¨??????????O(qn)


def linear_search(S, T):
    count = 0
    for t in T:
        if t in S:
            count += 1
    return count

if __name__ == '__main__':
    NS = int(input())
    S = list(map(int, input().split()))
    NT = int(input())
    T = list(map(int, input().split()))

    print(linear_search(S, T))