num = gets.chomp.to_i arr = gets.chomp.split.map(&:to_i) ans = [] for i in 1...arr.length ans.push (arr[i] - arr[i-1]).abs end ans.reverse! puts ans[0]