 i = gets.to_i
 ary = gets.split(" ").map(&:to_i)
 a = 0
 b = ary.inject(:+)
 goal = 100000000
(0..i-2).each do |n|
      a += ary[n]
      b -= ary[n]
      k = a-b
      if goal > k.abs
          goal = k.abs
      end
end
puts goal