n = int(input())
w = list(map(int,input().split()))
ans = abs(sum(w[0:1]) - sum(w[1:n+1]))
for i in range(1,n-1):
  a = abs(sum(w[0:i+1]) - sum(w[i+1:n+1]))
  ans = min(ans,a)
print(ans) n = int(input()) n int(input()) int input() input w = list(map(int,input().split())) w list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans = abs(sum(w[0:1]) - sum(w[1:n+1])) ans abs(sum(w[0:1]) - sum(w[1:n+1])) abs sum(w[0:1]) - sum(w[1:n+1]) sum(w[0:1]) sum w[0:1] w 0:1 0 1 sum(w[1:n+1]) sum w[1:n+1] w 1:n+1 1 n+1 n 1 for i in range(1,n-1):
  a = abs(sum(w[0:i+1]) - sum(w[i+1:n+1]))
  ans = min(ans,a) i range(1,n-1) range 1 n-1 n 1 a = abs(sum(w[0:i+1]) - sum(w[i+1:n+1])) a abs(sum(w[0:i+1]) - sum(w[i+1:n+1])) abs sum(w[0:i+1]) - sum(w[i+1:n+1]) sum(w[0:i+1]) sum w[0:i+1] w 0:i+1 0 i+1 i 1 sum(w[i+1:n+1]) sum w[i+1:n+1] w i+1:n+1 i+1 i 1 n+1 n 1 ans = min(ans,a) ans min(ans,a) min ans a print(ans) print ans a = abs(sum(w[0:i+1]) - sum(w[i+1:n+1])) abs(sum(w[0:i+1]) - sum(w[i+1:n+1])) a n = int(input()) int(input()) n w = list(map(int,input().split())) list(map(int,input().split())) w ans = abs(sum(w[0:1]) - sum(w[1:n+1])) abs(sum(w[0:1]) - sum(w[1:n+1])) ans ans = min(ans,a) min(ans,a) ans
n = int(input())
w = list(map(int,input().split()))
ans = abs(sum(w[0:1]) - sum(w[1:n+1]))
for i in range(1,n-1):
  a = abs(sum(w[0:i+1]) - sum(w[i+1:n+1]))
  ans = min(ans,a)
print(ans)