N = gets.to_i A = gets.split.map(&:to_i) puts A.sum { |x| A.include?(x - 1) ? 0 : x }