local N = io.read("n")
local W = {}

for i=1, N do
    local w = io.read("n")
    W[i] = w
end

local ans = 100 * 100
for T=1,N do
    local sum_left = 0
    local sum_right = 0
    for i=1,T do
        sum_left = sum_left + W[i]
    end
    for i=T+1,N do
        sum_right = sum_right + W[i]
    end
    ans = math.min(ans, math.abs(sum_left - sum_right))
end
print(ans)
