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

import sys
import os


n = int(input())
S = list(map(int, input().split()))

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

count = 0
for query in T:
    if query in S:
        count += 1
print(count) import sys sys import os os n = int(input()) n int(input()) int input() input S = list(map(int, input().split())) S list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split q = int(input()) q int(input()) int input() input T = list(map(int, input().split())) T list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split count = 0 count 0 for query in T:
    if query in S:
        count += 1 query T if query in S:
        count += 1 query in S query S count += 1 count 1 print(count) print count S = list(map(int, input().split())) list(map(int, input().split())) S n = int(input()) int(input()) n q = int(input()) int(input()) q T = list(map(int, input().split())) list(map(int, input().split())) T count = 0 0 count count += 1 1 count
# -*- coding: utf-8 -*-

import sys
import os


n = int(input())
S = list(map(int, input().split()))

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

count = 0
for query in T:
    if query in S:
        count += 1
print(count)