n = gets.to_i
d = gets.chomp.split(" ").map(&:to_i)
q = d.max
ans = 0
for j in 1..q
  count1 = 0
  count2 = 0
  for k in 0..n-1
  	if d[k] >= j
      count1 += 1
    else 
      count2 += 1
    end
  end
  if count1 == count2
    ans += 1
  else ans += 0
  end
end
puts ans
