#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
int n, a[MAXN], x, y;
int main(){
	scanf("%d", &n);
	for (int i=1;i<=n;i++){
		scanf("%d", &a[i]);
		y += a[i];
	} 
	int ans = 10001;
	for (int i = 1; i <= n; i++) {
		x += a[i];
		y -= a[i];
		ans = min(abs(x - y),ans);
	}
	cout << ans << endl;
	return 0;nocopy
}

0 comments

No comments so far...