count = 0
$s = $t = []
STDIN.each_line {|line|
  if count == 0
  elsif count == 1
    $s = line.split " "
  elsif count == 2
  elsif count == 3
    $t = line.split " "
  end

  count += 1
}

$s.map! {|item| item.to_i }
$t.map! {|item| item.to_i }

def search s, value
  l = 0
  r = s.length
  while (l  + 1 < r)
    i = (r + l) / 2
    if s[i] <= value
      l = i
    else
      r = i
    end

    return s[l] == value
  end
end


result = 0
$t.each do |value|
  if search $s, value
    result += 1
  end
end

puts result

