import math
inp = int(input())
var = list(map(int,input().split()))
l = []
for i in range(inp-1):
  a = math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1]))
  l.append(a)
print(int(min(l))) import math math inp = int(input()) inp int(input()) int input() input var = list(map(int,input().split())) var list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l = [] l [] for i in range(inp-1):
  a = math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1]))
  l.append(a) i range(inp-1) range inp-1 inp 1 a = math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1])) a math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1])) math.fabs math fabs sum(var[0:i+1]) - sum(var[i+1:inp+1]) sum(var[0:i+1]) sum var[0:i+1] var 0:i+1 0 i+1 i 1 sum(var[i+1:inp+1]) sum var[i+1:inp+1] var i+1:inp+1 i+1 i 1 inp+1 inp 1 l.append(a) l.append l append a print(int(min(l))) print int(min(l)) int min(l) min l inp = int(input()) int(input()) inp a = math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1])) math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1])) a var = list(map(int,input().split())) list(map(int,input().split())) var l = [] [] l
import math
inp = int(input())
var = list(map(int,input().split()))
l = []
for i in range(inp-1):
  a = math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1]))
  l.append(a)
print(int(min(l)))