import sys

n = int(sys.stdin.readline())
S = [int(x) for x in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
T = [int(x) for x in sys.stdin.readline().split()]

count = 0
for t in T:
    for s in S:
        if s == t:
            count += 1
            break

print(count) import sys sys n = int(sys.stdin.readline()) n int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x S = [int(x) for x in sys.stdin.readline().split()] S [int(x) for x in sys.stdin.readline().split()] q = int(sys.stdin.readline()) q int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x T = [int(x) for x in sys.stdin.readline().split()] T [int(x) for x in sys.stdin.readline().split()] count = 0 count 0 for t in T:
    for s in S:
        if s == t:
            count += 1
            break t T for s in S:
        if s == t:
            count += 1
            break s S if s == t:
            count += 1
            break s == t s t count += 1 count 1 break print(count) print count T = [int(x) for x in sys.stdin.readline().split()] [int(x) for x in sys.stdin.readline().split()] T q = int(sys.stdin.readline()) int(sys.stdin.readline()) q n = int(sys.stdin.readline()) int(sys.stdin.readline()) n S = [int(x) for x in sys.stdin.readline().split()] [int(x) for x in sys.stdin.readline().split()] S count = 0 0 count count += 1 1 count
import sys

n = int(sys.stdin.readline())
S = [int(x) for x in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
T = [int(x) for x in sys.stdin.readline().split()]

count = 0
for t in T:
    for s in S:
        if s == t:
            count += 1
            break

print(count)
