def linear_search(s,t):
    count = 0
    check_list = []
    for i in s:
        for j in t:
            if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
    return count

sline = []
tline = []

n = int(input())

sline = list(map(int,input().split()))
if len(sline) != n:
    print("Error")
    exit()

q = int(input())

tline = list(map(int,input().split()))
if len(tline) != q:
    print("Error")
    print(len(tline),q)
    exit()

count = linear_search(sline,tline)

print(count)
 def linear_search(s,t):
    count = 0
    check_list = []
    for i in s:
        for j in t:
            if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
    return count linear_search count = 0 count 0 check_list = [] check_list [] for i in s:
        for j in t:
            if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
     i s for j in t:
            if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
     j t if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
     i == j and (j in check_list) == False i == j i j (j in check_list) == False j in check_list j check_list False count = count + 1 count count + 1 count 1 check_list.append(j) check_list.append check_list append j return count count s s t t sline = [] sline [] tline = [] tline [] n = int(input()) n int(input()) int input() input sline = list(map(int,input().split())) sline list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split if len(sline) != n:
    print("Error")
    exit() len(sline) != n len(sline) len sline n print("Error") print "Error" exit() exit q = int(input()) q int(input()) int input() input tline = list(map(int,input().split())) tline list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split if len(tline) != q:
    print("Error")
    print(len(tline),q)
    exit() len(tline) != q len(tline) len tline q print("Error") print "Error" print(len(tline),q) print len(tline) len tline q exit() exit count = linear_search(sline,tline) count linear_search(sline,tline) linear_search sline tline print(count) print count tline = [] [] tline sline = list(map(int,input().split())) list(map(int,input().split())) sline n = int(input()) int(input()) n def linear_search(s,t):
    count = 0
    check_list = []
    for i in s:
        for j in t:
            if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
    return count def linear_search(s,t):
    count = 0
    check_list = []
    for i in s:
        for j in t:
            if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
    return count linear_search sline = [] [] sline q = int(input()) int(input()) q tline = list(map(int,input().split())) list(map(int,input().split())) tline count = linear_search(sline,tline) linear_search(sline,tline) count
def linear_search(s,t):
    count = 0
    check_list = []
    for i in s:
        for j in t:
            if i == j and (j in check_list) == False:
                count = count + 1
                check_list.append(j)
    return count

sline = []
tline = []

n = int(input())

sline = list(map(int,input().split()))
if len(sline) != n:
    print("Error")
    exit()

q = int(input())

tline = list(map(int,input().split()))
if len(tline) != q:
    print("Error")
    print(len(tline),q)
    exit()

count = linear_search(sline,tline)

print(count)

