import 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];
		int s1=0;
		int s2=0;
		int sum=0;
		int min=101;
		int k=0;
		
		for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		}
		
		int j=0;
		
		for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		}
		
		System.out.println(min);
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int s1=0;
		int s2=0;
		int sum=0;
		int min=101;
		int k=0;
		
		for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		}
		
		int j=0;
		
		for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		}
		
		System.out.println(min);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int s1=0;
		int s2=0;
		int sum=0;
		int min=101;
		int k=0;
		
		for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		}
		
		int j=0;
		
		for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		}
		
		System.out.println(min);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int s1=0;
		int s2=0;
		int sum=0;
		int min=101;
		int k=0;
		
		for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		}
		
		int j=0;
		
		for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		}
		
		System.out.println(min);
		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]; W new int[N] N int s1=0; s1 0 int s2=0; s2 0 int sum=0; sum 0 int min=101; min 101 int k=0; k 0 for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			W[i]=sc.nextInt();
			sum+=W[i];
		} {
			W[i]=sc.nextInt();
			sum+=W[i];
		} W[i]=sc.nextInt() W[i] W i sc.nextInt() sc.nextInt sc sum+=W[i] sum W[i] W i int j=0; j 0 for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		} {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		} k+=W[i] k W[i] W i j=sum-k j sum-k sum k if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			} Math.abs(j-k)<min Math.abs(j-k) Math.abs Math j-k j k min {
				min=Math.abs(j-k);
			} min=Math.abs(j-k) min Math.abs(j-k) Math.abs Math j-k j k System.out.println(min) System.out.println System.out System System.out min 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];
		int s1=0;
		int s2=0;
		int sum=0;
		int min=101;
		int k=0;
		
		for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		}
		
		int j=0;
		
		for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		}
		
		System.out.println(min);
		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];
		int s1=0;
		int s2=0;
		int sum=0;
		int min=101;
		int k=0;
		
		for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		}
		
		int j=0;
		
		for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		}
		
		System.out.println(min);
		sc.close();
	}
} Main
import 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];
		int s1=0;
		int s2=0;
		int sum=0;
		int min=101;
		int k=0;
		
		for(int i=0;i<N;i++) {
			W[i]=sc.nextInt();
			sum+=W[i];
		}
		
		int j=0;
		
		for(int i=0;i<N;i++) {
			k+=W[i];
			j=sum-k;
			if(Math.abs(j-k)<min) {
				min=Math.abs(j-k);
			}
		}
		
		System.out.println(min);
		sc.close();
	}
}
