n,*a=$<.read.split.map &:to_i a.sort! p n.times.count{|i|a[i+1]||a[-1]>a[i-1]+1}