n = gets.to_i
w = gets.split.map(&:to_i)
w_sum = w.inject(:+)
prefix_sum = 0
ans = 100 * 100 + 1

n.times do |i|
  prefix_sum += w[i]
  diff = ((w_sum - prefix_sum) - prefix_sum).abs
  ans = diff if ans > diff
end

puts ans