--bin search

import Data.Array


--assume that input array was sorted by assending

find::Array Int Int ->Int->(Int,Int)->Bool
find ar x (start,end)  =  let mid = div (start + end) 2 in
                          if (ar!mid ==x) || (ar!start ==x) || (ar!end ==x) then True else
                          if end - start <=1 then False else
                          if (ar!mid) > x then find ar x (start,mid) else
                          if (ar!mid) < x then find ar x (mid+1,end) else  False


--first
solver::Array Int Int -> [Int] -> Int
solver s t = sum (map (\ x -> if find s x (bounds s) then 1 else 0) t)

main::IO()
main = do
  nc<-getLine
  let n = read nc
  sc<-getLine
  let s = map read (words sc)::[Int]
  let s_arr = listArray (1,n) s
  _<-getLine
  tc<-getLine
  let t = map read (words tc)::[Int]
  print (solver s_arr t)