n = int(input())
weight_lists = list(map(int, input().split()))

tmp = 1000000
for i in range(1, n, 1):
    s_1 = weight_lists[:i]
    s_2 = weight_lists[i:]

    s_1_sum = 0
    for j in s_1:
        s_1_sum += j

    s_2_sum = 0
    for k in s_2:
        s_2_sum += k

    diff = abs(s_1_sum - s_2_sum)
    if diff < tmp:
        tmp = diff
        ans = tmp

print(ans) n = int(input()) n int(input()) int input() input weight_lists = list(map(int, input().split())) weight_lists list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split tmp = 1000000 tmp 1000000 for i in range(1, n, 1):
    s_1 = weight_lists[:i]
    s_2 = weight_lists[i:]

    s_1_sum = 0
    for j in s_1:
        s_1_sum += j

    s_2_sum = 0
    for k in s_2:
        s_2_sum += k

    diff = abs(s_1_sum - s_2_sum)
    if diff < tmp:
        tmp = diff
        ans = tmp i range(1, n, 1) range 1 n 1 s_1 = weight_lists[:i] s_1 weight_lists[:i] weight_lists :i i s_2 = weight_lists[i:] s_2 weight_lists[i:] weight_lists i: i s_1_sum = 0 s_1_sum 0 for j in s_1:
        s_1_sum += j

     j s_1 s_1_sum += j s_1_sum j s_2_sum = 0 s_2_sum 0 for k in s_2:
        s_2_sum += k

     k s_2 s_2_sum += k s_2_sum k diff = abs(s_1_sum - s_2_sum) diff abs(s_1_sum - s_2_sum) abs s_1_sum - s_2_sum s_1_sum s_2_sum if diff < tmp:
        tmp = diff
        ans = tmp diff < tmp diff tmp tmp = diff tmp diff ans = tmp ans tmp print(ans) print ans s_2_sum += k k s_2_sum weight_lists = list(map(int, input().split())) list(map(int, input().split())) weight_lists s_1_sum += j j s_1_sum diff = abs(s_1_sum - s_2_sum) abs(s_1_sum - s_2_sum) diff s_1_sum = 0 0 s_1_sum s_2_sum = 0 0 s_2_sum s_1 = weight_lists[:i] weight_lists[:i] s_1 tmp = 1000000 1000000 tmp s_2 = weight_lists[i:] weight_lists[i:] s_2 n = int(input()) int(input()) n tmp = diff diff tmp ans = tmp tmp ans
n = int(input())
weight_lists = list(map(int, input().split()))

tmp = 1000000
for i in range(1, n, 1):
    s_1 = weight_lists[:i]
    s_2 = weight_lists[i:]

    s_1_sum = 0
    for j in s_1:
        s_1_sum += j

    s_2_sum = 0
    for k in s_2:
        s_2_sum += k

    diff = abs(s_1_sum - s_2_sum)
    if diff < tmp:
        tmp = diff
        ans = tmp

print(ans)