N = int(input())
W = [int(i) for i in input().split()]

ans = sum(W)
s = ans
t = 0
for i in W:
  s -= i
  t += i
  ans = min(abs(s-t), ans)
  
print(ans) N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i W = [int(i) for i in input().split()] W [int(i) for i in input().split()] ans = sum(W) ans sum(W) sum W s = ans s ans t = 0 t 0 for i in W:
  s -= i
  t += i
  ans = min(abs(s-t), ans)
   i W s -= i s i t += i t i ans = min(abs(s-t), ans) ans min(abs(s-t), ans) min abs(s-t) abs s-t s t ans print(ans) print ans ans = min(abs(s-t), ans) min(abs(s-t), ans) ans t += i i t t = 0 0 t s = ans ans s s -= i i s N = int(input()) int(input()) N ans = sum(W) sum(W) ans W = [int(i) for i in input().split()] [int(i) for i in input().split()] W
N = int(input())
W = [int(i) for i in input().split()]

ans = sum(W)
s = ans
t = 0
for i in W:
  s -= i
  t += i
  ans = min(abs(s-t), ans)
  
print(ans)