import java.util.*;

class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		Integer[] array = new Integer[n];
		
		for(int i = 0; i < n; ++i) {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		}
		
		int total = 0;
		int sum_1 = 0;
		int sum_2 = 0;
		
		int mini = 100;
		
		for(int i = 0; i < n; ++i) {
		    total += array[i];
		}
		
		for(int i = 0; i < n; ++i) {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		}
		
		System.out.println(mini);
	
	}
} import java.util.*; util.* java class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		Integer[] array = new Integer[n];
		
		for(int i = 0; i < n; ++i) {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		}
		
		int total = 0;
		int sum_1 = 0;
		int sum_2 = 0;
		
		int mini = 100;
		
		for(int i = 0; i < n; ++i) {
		    total += array[i];
		}
		
		for(int i = 0; i < n; ++i) {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		}
		
		System.out.println(mini);
	
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		Integer[] array = new Integer[n];
		
		for(int i = 0; i < n; ++i) {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		}
		
		int total = 0;
		int sum_1 = 0;
		int sum_2 = 0;
		
		int mini = 100;
		
		for(int i = 0; i < n; ++i) {
		    total += array[i];
		}
		
		for(int i = 0; i < n; ++i) {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		}
		
		System.out.println(mini);
	
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		Integer[] array = new Integer[n];
		
		for(int i = 0; i < n; ++i) {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		}
		
		int total = 0;
		int sum_1 = 0;
		int sum_2 = 0;
		
		int mini = 100;
		
		for(int i = 0; i < n; ++i) {
		    total += array[i];
		}
		
		for(int i = 0; i < n; ++i) {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		}
		
		System.out.println(mini);
	
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Integer[] array = new Integer[n]; array new Integer[n] n for(int i = 0; i < n; ++i) {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		} {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		} int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc array[i] = tmp array[i] array i tmp int total = 0; total 0 int sum_1 = 0; sum_1 0 int sum_2 = 0; sum_2 0 int mini = 100; mini 100 for(int i = 0; i < n; ++i) {
		    total += array[i];
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
		    total += array[i];
		} {
		    total += array[i];
		} total += array[i] total array[i] array i for(int i = 0; i < n; ++i) {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		} {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		} sum_1 += array[i] sum_1 array[i] array i sum_2 = total - sum_1 sum_2 total - sum_1 total sum_1 if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        } mini > Math.abs(sum_1 - sum_2) mini Math.abs(sum_1 - sum_2) Math.abs Math sum_1 - sum_2 sum_1 sum_2 {
		            mini = Math.abs(sum_1 - sum_2);
		        } mini = Math.abs(sum_1 - sum_2) mini Math.abs(sum_1 - sum_2) Math.abs Math sum_1 - sum_2 sum_1 sum_2 System.out.println(mini) System.out.println System.out System System.out mini String[] args args
import java.util.*;

class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		Integer[] array = new Integer[n];
		
		for(int i = 0; i < n; ++i) {
		    int tmp = sc.nextInt();
		    array[i] = tmp;
		}
		
		int total = 0;
		int sum_1 = 0;
		int sum_2 = 0;
		
		int mini = 100;
		
		for(int i = 0; i < n; ++i) {
		    total += array[i];
		}
		
		for(int i = 0; i < n; ++i) {
		        sum_1 += array[i];
		        sum_2 = total - sum_1;
		        
		        if(mini > Math.abs(sum_1 - sum_2)) {
		            mini = Math.abs(sum_1 - sum_2);
		        }
		}
		
		System.out.println(mini);
	
	}
}