def linear_search(array, value)
  count = 0
  length = array.length
  for i in 0..(length-1)
    if array[i] != value
      count += 1
    elsif count == value
      break
    else
    return true
end
  end
end

n = gets.chomp.to_i
s = gets.chomp.split.map(&:to_i)
q = gets.chomp.to_i
t = gets.chomp.split.map(&:to_i)

sum_count = 0
  for i in 0..(n-1)
    if linear_search(s, t[i]) == true
      sum_count += 1
    end
  end

puts sum_count