#import <stdio.h>
#import <limits.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-(a)))
int main(){
    int N;
    int W[101] = {0};
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",W+i);
    }
    int S[101] = {0};
    for(int i=0;i<N;i++){
        S[i] = W[i] + ((i==0) ? 0 : S[i-1]);
    }
    int min = INT_MAX;
    for(int i=0;i<N;i++){
        min = MIN(min, ABS(2*S[i] - S[N-1]));
    }
    printf("%d",min);
}
