import numpy as np
n = int(input())
w = np.array([int(i) for i in input().split()])
ans = 10000000
for t in range(1,n):
    s1 = w[:t].sum()
    s2 = w[t:].sum()
    ans = min(ans, np.abs(s1-s2))
print(ans) import numpy as np numpy n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i w = np.array([int(i) for i in input().split()]) w np.array([int(i) for i in input().split()]) np.array np array [int(i) for i in input().split()] ans = 10000000 ans 10000000 for t in range(1,n):
    s1 = w[:t].sum()
    s2 = w[t:].sum()
    ans = min(ans, np.abs(s1-s2)) t range(1,n) range 1 n s1 = w[:t].sum() s1 w[:t].sum() [:t].sum [:t] w :t t sum s2 = w[t:].sum() s2 w[t:].sum() [t:].sum [t:] w t: t sum ans = min(ans, np.abs(s1-s2)) ans min(ans, np.abs(s1-s2)) min ans np.abs(s1-s2) np.abs np abs s1-s2 s1 s2 print(ans) print ans n = int(input()) int(input()) n ans = min(ans, np.abs(s1-s2)) min(ans, np.abs(s1-s2)) ans s1 = w[:t].sum() w[:t].sum() s1 s2 = w[t:].sum() w[t:].sum() s2 w = np.array([int(i) for i in input().split()]) np.array([int(i) for i in input().split()]) w ans = 10000000 10000000 ans
import numpy as np
n = int(input())
w = np.array([int(i) for i in input().split()])
ans = 10000000
for t in range(1,n):
    s1 = w[:t].sum()
    s2 = w[t:].sum()
    ans = min(ans, np.abs(s1-s2))
print(ans)
