#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

n = int(sys.stdin.readline())
s = list(map(int, sys.stdin.readline().split()))
q = int(sys.stdin.readline())
t = list(map(int, sys.stdin.readline().split()))

s_set = set(s)
total = 0

for x in t:
    if x in s_set:
        total += 1

print(total)
 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 s = list(map(int, sys.stdin.readline().split())) s list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin 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 t = list(map(int, sys.stdin.readline().split())) t list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split s_set = set(s) s_set set(s) set s total = 0 total 0 for x in t:
    if x in s_set:
        total += 1 x t if x in s_set:
        total += 1 x in s_set x s_set total += 1 total 1 print(total) print total total += 1 1 total n = int(sys.stdin.readline()) int(sys.stdin.readline()) n q = int(sys.stdin.readline()) int(sys.stdin.readline()) q t = list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) t s = list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) s total = 0 0 total s_set = set(s) set(s) s_set
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

n = int(sys.stdin.readline())
s = list(map(int, sys.stdin.readline().split()))
q = int(sys.stdin.readline())
t = list(map(int, sys.stdin.readline().split()))

s_set = set(s)
total = 0

for x in t:
    if x in s_set:
        total += 1

print(total)

