import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N      = scanner.nextInt();
		int total  = 0;
		int totalA = 0;
		int totalB = 0;
		int temp   = 0;
		int answer = 101;
		int[]W     = new int[N];
		
		//合計を取得
		for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		}
		
		//前のグループと後ろのグループの差を確認
		for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		}
		System.out.println(Math.abs(answer));
	}

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

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N      = scanner.nextInt();
		int total  = 0;
		int totalA = 0;
		int totalB = 0;
		int temp   = 0;
		int answer = 101;
		int[]W     = new int[N];
		
		//合計を取得
		for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		}
		
		//前のグループと後ろのグループの差を確認
		for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		}
		System.out.println(Math.abs(answer));
	}

} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N      = scanner.nextInt();
		int total  = 0;
		int totalA = 0;
		int totalB = 0;
		int temp   = 0;
		int answer = 101;
		int[]W     = new int[N];
		
		//合計を取得
		for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		}
		
		//前のグループと後ろのグループの差を確認
		for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		}
		System.out.println(Math.abs(answer));
	} main {

		Scanner scanner = new Scanner(System.in);
		int N      = scanner.nextInt();
		int total  = 0;
		int totalA = 0;
		int totalB = 0;
		int temp   = 0;
		int answer = 101;
		int[]W     = new int[N];
		
		//合計を取得
		for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		}
		
		//前のグループと後ろのグループの差を確認
		for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		}
		System.out.println(Math.abs(answer));
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N      = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int total  = 0; total 0 int totalA = 0; totalA 0 int totalB = 0; totalB 0 int temp   = 0; temp 0 int answer = 101; answer 101 int[]W     = new int[N]; W new int[N] N for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		} int i = 0; int i = 0; i 0 i < N i N i ++ i ++ i {
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		} {
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		} W[i] = scanner.nextInt() W[i] W i scanner.nextInt() scanner.nextInt scanner total = total + W[i] total total + W[i] total W[i] W i for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		} int i = 0; int i = 0; i 0 i < N i N i ++ i ++ i {
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		} {
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		} totalA = totalA + W[i] totalA totalA + W[i] totalA W[i] W i totalB = total - totalA totalB total - totalA total totalA temp   = totalA - totalB temp totalA - totalB totalA totalB if(temp < Math.abs(answer)){
				
				answer = temp;
			} temp < Math.abs(answer) temp Math.abs(answer) Math.abs Math answer {
				
				answer = temp;
			} answer = temp answer temp System.out.println(Math.abs(answer)) System.out.println System.out System System.out Math.abs(answer) Math.abs Math answer String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N      = scanner.nextInt();
		int total  = 0;
		int totalA = 0;
		int totalB = 0;
		int temp   = 0;
		int answer = 101;
		int[]W     = new int[N];
		
		//合計を取得
		for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		}
		
		//前のグループと後ろのグループの差を確認
		for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		}
		System.out.println(Math.abs(answer));
	}

} public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N      = scanner.nextInt();
		int total  = 0;
		int totalA = 0;
		int totalB = 0;
		int temp   = 0;
		int answer = 101;
		int[]W     = new int[N];
		
		//合計を取得
		for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		}
		
		//前のグループと後ろのグループの差を確認
		for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		}
		System.out.println(Math.abs(answer));
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N      = scanner.nextInt();
		int total  = 0;
		int totalA = 0;
		int totalB = 0;
		int temp   = 0;
		int answer = 101;
		int[]W     = new int[N];
		
		//合計を取得
		for(int i = 0; i < N; i ++){
			
			W[i] = scanner.nextInt();
			total = total + W[i];
		}
		
		//前のグループと後ろのグループの差を確認
		for(int i = 0; i < N; i ++){
			
			totalA = totalA + W[i];
			totalB = total - totalA;
			temp   = totalA - totalB;
			
			//差が最小になったとき
			if(temp < Math.abs(answer)){
				
				answer = temp;
			}
		}
		System.out.println(Math.abs(answer));
	}

}