import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] W=new int[N+1];
		W[0]=0;

		for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i];

		int ans=1000000;

		for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		}

		System.out.println(ans);

		sc.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] W=new int[N+1];
		W[0]=0;

		for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i];

		int ans=1000000;

		for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		}

		System.out.println(ans);

		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] W=new int[N+1];
		W[0]=0;

		for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i];

		int ans=1000000;

		for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		}

		System.out.println(ans);

		sc.close();
	} main {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] W=new int[N+1];
		W[0]=0;

		for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i];

		int ans=1000000;

		for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		}

		System.out.println(ans);

		sc.close();
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] W=new int[N+1]; W new int[N+1] N+1 N 1 W[0]=0 W[0] W 0 0 for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i]; int i=0; int i=0; i 0 i<N i N i++ i++ i W[i+1]=sc.nextInt()+W[i]; W[i+1]=sc.nextInt()+W[i] W[i+1] W i+1 i 1 sc.nextInt()+W[i] sc.nextInt() sc.nextInt sc W[i] W i int ans=1000000; ans 1000000 for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		} {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		} int S1=W[i]; S1 W[i] W i int S2=W[N]-W[i]; S2 W[N]-W[i] W[N] W N W[i] W i ans=Math.min(Math.abs(S1-S2), ans) ans Math.min(Math.abs(S1-S2), ans) Math.min Math Math.abs(S1-S2) Math.abs Math S1-S2 S1 S2 ans System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] W=new int[N+1];
		W[0]=0;

		for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i];

		int ans=1000000;

		for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		}

		System.out.println(ans);

		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] W=new int[N+1];
		W[0]=0;

		for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i];

		int ans=1000000;

		for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		}

		System.out.println(ans);

		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] W=new int[N+1];
		W[0]=0;

		for(int i=0;i<N;i++)  W[i+1]=sc.nextInt()+W[i];

		int ans=1000000;

		for(int i=1;i<N;i++) {
			int S1=W[i];
			int S2=W[N]-W[i];
			ans=Math.min(Math.abs(S1-S2), ans);
		}

		System.out.println(ans);

		sc.close();
	}

}
