#include <cstdio>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;

int n,s[105],ans=0x3f3f3f3f;
int a[105];

int main(void){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%d",&a[i]),
	s[i]=s[i-1]+a[i];
	for(int i=1;i<n;i++){
		ans=min(ans,abs(s[i]-s[n]+s[i]));
	}
	printf("%d",ans);
}
