import sys
n = int(sys.stdin.readline()[:-1])
S = sorted(list(map(int, (sys.stdin.readline()[:-1]).split())))
q = int(sys.stdin.readline()[:-1])
T = sorted(list(map(int, (sys.stdin.readline()[:-1]).split())))

count = 0
for i in T:
    x = 0
    while x < len(S):
        if i == S[x]:
            count += 1
            S = S[x:]
            break
        x += 1

print(count) import sys sys n = int(sys.stdin.readline()[:-1]) n int(sys.stdin.readline()[:-1]) int sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 S = sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) S sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) sorted list(map(int, (sys.stdin.readline()[:-1]).split())) list map(int, (sys.stdin.readline()[:-1]).split()) map int (sys.stdin.readline()[:-1]).split() sys.stdin.readline()[:-1]).split sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 split q = int(sys.stdin.readline()[:-1]) q int(sys.stdin.readline()[:-1]) int sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 T = sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) T sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) sorted list(map(int, (sys.stdin.readline()[:-1]).split())) list map(int, (sys.stdin.readline()[:-1]).split()) map int (sys.stdin.readline()[:-1]).split() sys.stdin.readline()[:-1]).split sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 split count = 0 count 0 for i in T:
    x = 0
    while x < len(S):
        if i == S[x]:
            count += 1
            S = S[x:]
            break
        x += 1 i T x = 0 x 0 while x < len(S):
        if i == S[x]:
            count += 1
            S = S[x:]
            break
        x += 1 x < len(S) x len(S) len S if i == S[x]:
            count += 1
            S = S[x:]
            break
         i == S[x] i S[x] S x count += 1 count 1 S = S[x:] S S[x:] S x: x break x += 1 x 1 print(count) print count T = sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) T q = int(sys.stdin.readline()[:-1]) int(sys.stdin.readline()[:-1]) q x += 1 1 x count += 1 1 count count = 0 0 count S = sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) sorted(list(map(int, (sys.stdin.readline()[:-1]).split()))) S S = S[x:] S[x:] S n = int(sys.stdin.readline()[:-1]) int(sys.stdin.readline()[:-1]) n x = 0 0 x
import sys
n = int(sys.stdin.readline()[:-1])
S = sorted(list(map(int, (sys.stdin.readline()[:-1]).split())))
q = int(sys.stdin.readline()[:-1])
T = sorted(list(map(int, (sys.stdin.readline()[:-1]).split())))

count = 0
for i in T:
    x = 0
    while x < len(S):
        if i == S[x]:
            count += 1
            S = S[x:]
            break
        x += 1

print(count)