def linear_search(target_array, value)
  target_array.each do |arr_value|
    return 1 if arr_value == value
  end
  0
end

n = gets.to_i
s = gets.chomp.split ' '
q = gets.to_i
t = gets.chomp.split ' '
count = 0
t.each do |value|
  count += linear_search s, value
end

puts count
