#include<bits/stdc++.h>
using namespace std;

int w[100];

int main(){
	int N;
	cin>>N;
	int sum=0;
	for(int i=0;i<N;i++){
		cin>>w[i];
		sum+=w[i];
		if(i>0)w[i]+=w[i-1];
	}
	int min=99999999;
	for(int i=0;i<N;i++){
		if(min>abs(sum-2*w[i]))min=abs(sum-2*w[i]);
	}
	cout<<min<<endl;
	return 0;
}