N = int(input())
li = list(map(int,input().split()))

m = float('inf')

for i in range(len(li[:-1])):
    m_new = abs(sum(li[:i+1])-sum(li[i+1:]))
    m = min(m,m_new)
print(m) N = int(input()) N int(input()) int input() input li = list(map(int,input().split())) li list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split m = float('inf') m float('inf') float 'inf' for i in range(len(li[:-1])):
    m_new = abs(sum(li[:i+1])-sum(li[i+1:]))
    m = min(m,m_new) i range(len(li[:-1])) range len(li[:-1]) len li[:-1] li :-1 -1 m_new = abs(sum(li[:i+1])-sum(li[i+1:])) m_new abs(sum(li[:i+1])-sum(li[i+1:])) abs sum(li[:i+1])-sum(li[i+1:]) sum(li[:i+1]) sum li[:i+1] li :i+1 i+1 i 1 sum(li[i+1:]) sum li[i+1:] li i+1: i+1 i 1 m = min(m,m_new) m min(m,m_new) min m m_new print(m) print m m = min(m,m_new) min(m,m_new) m li = list(map(int,input().split())) list(map(int,input().split())) li m_new = abs(sum(li[:i+1])-sum(li[i+1:])) abs(sum(li[:i+1])-sum(li[i+1:])) m_new N = int(input()) int(input()) N m = float('inf') float('inf') m
N = int(input())
li = list(map(int,input().split()))

m = float('inf')

for i in range(len(li[:-1])):
    m_new = abs(sum(li[:i+1])-sum(li[i+1:]))
    m = min(m,m_new)
print(m)