from collections import deque
import sys
input = sys.stdin.readline

_ = int(input())
S = [int(i) for i in input().strip().split()]
_ = int(input())
T = [int(i) for i in input().strip().split()]

ans = 0
for t in T:
    if t in S:
        ans += 1

print(ans)
 from collections import deque import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline _ = int(input()) _ int(input()) int input() input int(i) for i in input().strip().split() for i in input().strip().split() i input().strip().split() ().strip().split ().strip() ().strip () input strip split for i in input().strip().split() int(i) int i S = [int(i) for i in input().strip().split()] S [int(i) for i in input().strip().split()] _ = int(input()) _ int(input()) int input() input int(i) for i in input().strip().split() for i in input().strip().split() i input().strip().split() ().strip().split ().strip() ().strip () input strip split for i in input().strip().split() int(i) int i T = [int(i) for i in input().strip().split()] T [int(i) for i in input().strip().split()] ans = 0 ans 0 for t in T:
    if t in S:
        ans += 1 t T if t in S:
        ans += 1 t in S t S ans += 1 ans 1 print(ans) print ans input = sys.stdin.readline sys.stdin.readline input S = [int(i) for i in input().strip().split()] [int(i) for i in input().strip().split()] S _ = int(input()) int(input()) _ _ = int(input()) int(input()) _ T = [int(i) for i in input().strip().split()] [int(i) for i in input().strip().split()] T ans += 1 1 ans ans = 0 0 ans
from collections import deque
import sys
input = sys.stdin.readline

_ = int(input())
S = [int(i) for i in input().strip().split()]
_ = int(input())
T = [int(i) for i in input().strip().split()]

ans = 0
for t in T:
    if t in S:
        ans += 1

print(ans)

