_, s, _, t = readlines.map(&:chomp)
s = s.split.map(&:to_i)
t = t.split.map(&:to_i)

def include?(a, e)
  l = 0
  r = a.size - 1
  while(l <= r)
    m = (l + r) / 2
    return true if a[m] == e
    if a[m] < e
      l = m + 1
    else
      r = m - 1
    end
  end
  false
end

p t.count {|e| include?(s, e)}
