def linear_search(arr, i)
  arr.each do |j|
    return j if i == j
  end

  nil
end

gets
s = gets.split

gets
t = gets.split

count = 0

t.each do |i|
  count += 1 if linear_search(s, i)
end

puts count