# https://atcoder.jp/contests/abc129/tasks/abc129_b


N = gets.to_i
Ws = gets.split.map(&:to_i)
ttl = Ws.reduce(&:+)
ans = 100000
sum1 = 0
(N - 1).times do |i|
  sum1 += Ws[i]
  sum2 = ttl - sum1
  ans = [ans, (sum1 - sum2).abs].min
end
puts ans
