n = int(input())
w = [int(x) for x in input().split()]
ans = 1e9
for i in range(n):
  s1 = sum(w[:i])
  s2 = sum(w[i:])
  s = abs(s1 - s2)
  ans = min(s, ans)
print(ans) n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x w = [int(x) for x in input().split()] w [int(x) for x in input().split()] ans = 1e9 ans 1e9 for i in range(n):
  s1 = sum(w[:i])
  s2 = sum(w[i:])
  s = abs(s1 - s2)
  ans = min(s, ans) i range(n) range n s1 = sum(w[:i]) s1 sum(w[:i]) sum w[:i] w :i i s2 = sum(w[i:]) s2 sum(w[i:]) sum w[i:] w i: i s = abs(s1 - s2) s abs(s1 - s2) abs s1 - s2 s1 s2 ans = min(s, ans) ans min(s, ans) min s ans print(ans) print ans n = int(input()) int(input()) n s2 = sum(w[i:]) sum(w[i:]) s2 s1 = sum(w[:i]) sum(w[:i]) s1 ans = min(s, ans) min(s, ans) ans w = [int(x) for x in input().split()] [int(x) for x in input().split()] w s = abs(s1 - s2) abs(s1 - s2) s ans = 1e9 1e9 ans
n = int(input())
w = [int(x) for x in input().split()]
ans = 1e9
for i in range(n):
  s1 = sum(w[:i])
  s2 = sum(w[i:])
  s = abs(s1 - s2)
  ans = min(s, ans)
print(ans)