#!/usr/bin/env python

# -*- coding: utf-8 -*-



def find(S, x):

    left = 0

    right = n



    while right - left >= 1:

        mid = (left + right)//2



        if S[mid] == x:

            return True 



        if S[mid] < x:

            left = mid + 1

        else:

            right = mid



    return False



n = int(eval(input()))

S = sorted(map(int,input().split()))

q = int(eval(input()))

T = list(map(int,input().split()))



count = 0

for t in T:

    if find(S, t):

        count += 1

print(count)
#!/usr/bin/env python

# -*- coding: utf-8 -*-



n = int(eval(input()))

S = sorted(map(int,input().split()))

q = int(eval(input()))

T = list(map(int,input().split()))



print((len(set(S) & set(T))))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def find(S, x):
    left = 0
    right = n
    while right - left >= 1:
        mid = (left + right) // 2
        if S[mid] == x:
            return True
        if S[mid] < x:
            left = mid + 1
        else:
            right = mid
    return False


n = int(eval(input()))
S = sorted(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
count = 0
for t in T:
    if find(S, t):
        count += 1
print(count)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
n = int(eval(input()))
S = sorted(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
print((len(set(S) & set(T))))

-def find(S, x): -    left = 0 -    right = n -    while right - left >= 1: -        mid = (left + right) // 2 -        if S[mid] == x: -            return True -        if S[mid] < x: -            left = mid + 1 -        else: -            right = mid -    return False - - -count = 0 -for t in T: -    if find(S, t): -        count += 1 -print(count) +print((len(set(S) & set(T))))