puts ([0] + Array.new(gets.to_i) { gets.to_i }).each_cons(2).map{|x| x.inject(:-).abs }.all?{|x| x==1}