n = STDIN.gets.to_i
S = STDIN.gets.split(' ')
q = STDIN.gets.to_i
T = STDIN.gets.split(' ')

found_count = 0
T.each do |t|
  current = n/2
  prev = n
  until current == prev
    prev = current
    if S[current]==t
      found_count += 1
      break
    elsif S[current] > t
      current /= 2
    else
      current = current + (n-current)/2
    end
  end
end

print "#{found_count}\n"