@n = gets.to_i
S = gets.split(' ').map(&:to_i)
q = gets.to_i
T = gets.split(' ').map(&:to_i)

count = 0

def linearSearch(arr, target)
  i = 0
  arr[@n] = target # 番兵
  while(arr[i] != target)
    i += 1

    return nil if(i == @n)
  end
  return true
end

T.each do |t|
  count += 1 if linearSearch(S.dup, t)
end

puts count

