n=gets.chomp.to_i
t = gets.chomp.split(" ").map{|u|u.to_i}
t.sort!
gets
b = gets.chomp.split(" ").map{|u|u.to_i}
ans = 0
b.each do |d|
  r = n-1
  l = 0
  mid = 999999999
  while(true)
    mid = l + (r-l)/2
    if (t[mid] == d)
      ans += 1
      break
    elsif(t[mid] > d)
      r = mid
    else
      l = mid + 1
    end
    break if r == l
  end
end
p ans