// B - Balance
'use strict'
function main(input) {
  input = input.trim().split('\n')
  const N = Number(input.shift())
  input = input[0].split(' ').map(v => Number(v))
  let l = [input[0]]
  let r = [input[N-1]]
  let ans = 100
  for (let i = 1; i < N; i++) {
    l.push(l[i-1]+input[i])
    r.push(r[i-1]+input[N-i-1])
  }
  for (let i = 0; i < N - 1; i++) {
    let temp = Math.abs(l[i] - r[N-i-2])
    if (ans > temp) ans = temp
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
