 i = gets.to_i
 ary = gets.split(" ").map(&:to_i)
 new_ary = []
 goal = 100000000
(0..i-2).each do |n|
    new_ary << ary.shift
      k = new_ary.sum - ary.sum
      if goal > k.abs
          goal = k.abs
      end
end
puts goal