#include<iostream>
#include<string>
using namespace std;

int main(){
int n,i;
cin>>n;
int w[n],k[n],ans=1000000;
cin>>w[0];
k[0]=w[0];
for(i=1;i<n;i++){cin>>w[i];k[i]=k[i-1]+w[i];}
for(i=1;i<n;i++){ans=min(ans,abs(k[n-1]-k[i-1]-(k[i-1])));}
cout<<ans;
}