n = int(input())
weight = list(map(int,input().split()))
minimum_weight = abs(sum(weight[0:1]) - sum(weight[1:n+1]))

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

for i in range(1,n-1):
  minimum_weight = min(minimum_weight, abs(sum(weight[0:i+1]) - sum(weight[i+1:n+1])))
  
print(minimum_weight)