N = gets.to_i
W = gets.split.map(&:to_i)

result = []
1.upto(N-1) do |t|
  s1 = [0]
  s2 = [0]
  W.each_with_index do |w, i|
    if i + 1 > t
      s2 << w
    else
      s1 << w
    end
  end

  result << (s1.inject(:+) - s2.inject(:+)).abs
end

p result.min