import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//6/9コンテスト

public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sa=100;
		int konkai=1000;
		List<Integer> list= new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		//System.out.println(list.get(1));
		for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		}
		System.out.println(sa);



	}

} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util 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 sa=100;
		int konkai=1000;
		List<Integer> list= new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		//System.out.println(list.get(1));
		for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		}
		System.out.println(sa);



	}

} Main public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sa=100;
		int konkai=1000;
		List<Integer> list= new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		//System.out.println(list.get(1));
		for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		}
		System.out.println(sa);



	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sa=100;
		int konkai=1000;
		List<Integer> list= new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		//System.out.println(list.get(1));
		for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		}
		System.out.println(sa);



	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int sa=100; sa 100 int konkai=1000; konkai 1000 List<Integer> list= new ArrayList<Integer>(); list new ArrayList<Integer>() for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		} int i=0; int i=0; i 0 n>i n i i++ i++ i {
			int a = sc.nextInt();
			list.add(a);
		} {
			int a = sc.nextInt();
			list.add(a);
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc list.add(a) list.add list a for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		} int i=0; int i=0; i 0 n-1>i n-1 n 1 i i++ i++ i {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		} {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		} int one=0; one 0 int two=0; two 0 for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			} int l=0; int l=0; l 0 i+1>l i+1 i 1 l l++ l++ l {
				one=one+list.get(l);
			} {
				one=one+list.get(l);
			} one=one+list.get(l) one one+list.get(l) one list.get(l) list.get list l for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			} int t=0; int t=0; t 0 n-1-i>t n-1-i n-1-i n 1 i t t++ t++ t {
				two=two+list.get(n-1-t);
			} {
				two=two+list.get(n-1-t);
			} two=two+list.get(n-1-t) two two+list.get(n-1-t) two list.get(n-1-t) list.get list n-1-t n-1-t n 1 t konkai=Math.abs(one-two) konkai Math.abs(one-two) Math.abs Math one-two one two if(konkai<sa) {
				sa=konkai;
			} konkai<sa konkai sa {
				sa=konkai;
			} sa=konkai sa konkai System.out.println(sa) System.out.println System.out System System.out sa String[]args args public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sa=100;
		int konkai=1000;
		List<Integer> list= new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		//System.out.println(list.get(1));
		for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		}
		System.out.println(sa);



	}

} public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sa=100;
		int konkai=1000;
		List<Integer> list= new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		//System.out.println(list.get(1));
		for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		}
		System.out.println(sa);



	}

} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//6/9コンテスト

public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sa=100;
		int konkai=1000;
		List<Integer> list= new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		//System.out.println(list.get(1));
		for(int i=0;n-1>i;i++) {
			int one=0;
			int two=0;
			for(int l=0;i+1>l;l++) {
				one=one+list.get(l);
			}
			for(int t=0;n-1-i>t;t++) {
				two=two+list.get(n-1-t);
			}

			konkai=Math.abs(one-two);
			if(konkai<sa) {
				sa=konkai;
			}

		}
		System.out.println(sa);



	}

}
