import java.util.Scanner;
class Main {
	public  static void main(String[] args) {
 
		Scanner sc = new  Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int r_sum = 0;
		int l_sum = 0;
		int lmin = 100;
 
		for(int i =0;i<N;i++) {
			W[i] = sc.nextInt();
		}
 
		for(int i=1; i < N;i++) {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		}
		System.out.println(lmin);
 
	}
} import java.util.Scanner; Scanner java.util class Main {
	public  static void main(String[] args) {
 
		Scanner sc = new  Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int r_sum = 0;
		int l_sum = 0;
		int lmin = 100;
 
		for(int i =0;i<N;i++) {
			W[i] = sc.nextInt();
		}
 
		for(int i=1; i < N;i++) {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		}
		System.out.println(lmin);
 
	}
} Main public  static void main(String[] args) {
 
		Scanner sc = new  Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int r_sum = 0;
		int l_sum = 0;
		int lmin = 100;
 
		for(int i =0;i<N;i++) {
			W[i] = sc.nextInt();
		}
 
		for(int i=1; i < N;i++) {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		}
		System.out.println(lmin);
 
	} main {
 
		Scanner sc = new  Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int r_sum = 0;
		int l_sum = 0;
		int lmin = 100;
 
		for(int i =0;i<N;i++) {
			W[i] = sc.nextInt();
		}
 
		for(int i=1; i < N;i++) {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		}
		System.out.println(lmin);
 
	} 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]; W new int[N] N int r_sum = 0; r_sum 0 int l_sum = 0; l_sum 0 int lmin = 100; lmin 100 for(int i =0;i<N;i++) {
			W[i] = sc.nextInt();
		} int i =0; int i =0; i 0 i<N i N i++ i++ i {
			W[i] = sc.nextInt();
		} {
			W[i] = sc.nextInt();
		} W[i] = sc.nextInt() W[i] W i sc.nextInt() sc.nextInt sc for(int i=1; i < N;i++) {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		} int i=1; int i=1; i 1 i < N i N i++ i++ i {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		} {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		} r_sum = W[0] r_sum W[0] W 0 l_sum = 0 l_sum 0 for (int j = 1;j < i; j++) {
				r_sum += W[j];
			} int j = 1; int j = 1; j 1 j < i j i j++ j++ j {
				r_sum += W[j];
			} {
				r_sum += W[j];
			} r_sum += W[j] r_sum W[j] W j for (int z = i;z < N; z++) {
				l_sum += W[z];
			} int z = i; int z = i; z i z < N z N z++ z++ z {
				l_sum += W[z];
			} {
				l_sum += W[z];
			} l_sum += W[z] l_sum W[z] W z lmin = Math.min(lmin, Math.abs(r_sum - l_sum)) lmin Math.min(lmin, Math.abs(r_sum - l_sum)) Math.min Math lmin Math.abs(r_sum - l_sum) Math.abs Math r_sum - l_sum r_sum l_sum System.out.println(lmin) System.out.println System.out System System.out lmin String[] args args
import java.util.Scanner;
class Main {
	public  static void main(String[] args) {
 
		Scanner sc = new  Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int r_sum = 0;
		int l_sum = 0;
		int lmin = 100;
 
		for(int i =0;i<N;i++) {
			W[i] = sc.nextInt();
		}
 
		for(int i=1; i < N;i++) {
			r_sum = W[0];
			l_sum = 0;
			for (int j = 1;j < i; j++) {
				r_sum += W[j];
			}
			for (int z = i;z < N; z++) {
				l_sum += W[z];
			}
			lmin = Math.min(lmin, Math.abs(r_sum - l_sum));
		}
		System.out.println(lmin);
 
	}
}