def linear_search(array, value)
  length = array.length
  i = 0
  array.push(value)
  loop do
    if array[i] == value
      if i == length
        return false
        break
      else
        return true
        break
      end
    else
      i += 1
    end
  end
  array.delete(-1)
end

def linear_search(array, value)
  length = array.length
  for i in 0..(length-1)
    if array[i] == value
      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..(q-1)
    if linear_search(s, t[i]) == true
      sum_count += 1
    end
  end

puts sum_count