import numpy as np

N = int(input())
W = input().split()

for i in range(N):
    W[i] = int(W[i])
min_w= 1000000
for i in range(N-1):
    w1 = W[:i+1]
    w2 = W[i+1:]
    w1 = np.array(w1)
    w2 = np.array(w2)
    min_w = min(min_w, abs(np.sum(w2)-np.sum(w1)))

print(min_w) import numpy as np numpy N = int(input()) N int(input()) int input() input W = input().split() W input().split() ().split () input split for i in range(N):
    W[i] = int(W[i]) i range(N) range N W[i] = int(W[i]) W[i] W i int(W[i]) int W[i] W i min_w= 1000000 min_w 1000000 for i in range(N-1):
    w1 = W[:i+1]
    w2 = W[i+1:]
    w1 = np.array(w1)
    w2 = np.array(w2)
    min_w = min(min_w, abs(np.sum(w2)-np.sum(w1))) i range(N-1) range N-1 N 1 w1 = W[:i+1] w1 W[:i+1] W :i+1 i+1 i 1 w2 = W[i+1:] w2 W[i+1:] W i+1: i+1 i 1 w1 = np.array(w1) w1 np.array(w1) np.array np array w1 w2 = np.array(w2) w2 np.array(w2) np.array np array w2 min_w = min(min_w, abs(np.sum(w2)-np.sum(w1))) min_w min(min_w, abs(np.sum(w2)-np.sum(w1))) min min_w abs(np.sum(w2)-np.sum(w1)) abs np.sum(w2)-np.sum(w1) np.sum(w2) np.sum np sum w2 np.sum(w1) np.sum np sum w1 print(min_w) print min_w w1 = np.array(w1) np.array(w1) w1 min_w = min(min_w, abs(np.sum(w2)-np.sum(w1))) min(min_w, abs(np.sum(w2)-np.sum(w1))) min_w N = int(input()) int(input()) N W = input().split() input().split() W w2 = W[i+1:] W[i+1:] w2 w2 = np.array(w2) np.array(w2) w2 min_w= 1000000 1000000 min_w w1 = W[:i+1] W[:i+1] w1
import numpy as np

N = int(input())
W = input().split()

for i in range(N):
    W[i] = int(W[i])
min_w= 1000000
for i in range(N-1):
    w1 = W[:i+1]
    w2 = W[i+1:]
    w1 = np.array(w1)
    w2 = np.array(w2)
    min_w = min(min_w, abs(np.sum(w2)-np.sum(w1)))

print(min_w)