import java.util.Arrays; 
import java.util.Scanner; 
public class Main { public static void main(String[] args) { 
Scanner keyboard = new Scanner(System.in); 

int N = keyboard.nextInt(); 

int sumW = 0;
int[] s1 = new int[N];

for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
}

int[] z = new int[N-1];

int ans  = 1000000000;
for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
}

		System.out.println(ans);
		keyboard.close();
	 	}
 }  import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main { public static void main(String[] args) { 
Scanner keyboard = new Scanner(System.in); 

int N = keyboard.nextInt(); 

int sumW = 0;
int[] s1 = new int[N];

for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
}

int[] z = new int[N-1];

int ans  = 1000000000;
for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
}

		System.out.println(ans);
		keyboard.close();
	 	}
 } Main public static void main(String[] args) { 
Scanner keyboard = new Scanner(System.in); 

int N = keyboard.nextInt(); 

int sumW = 0;
int[] s1 = new int[N];

for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
}

int[] z = new int[N-1];

int ans  = 1000000000;
for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
}

		System.out.println(ans);
		keyboard.close();
	 	} main { 
Scanner keyboard = new Scanner(System.in); 

int N = keyboard.nextInt(); 

int sumW = 0;
int[] s1 = new int[N];

for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
}

int[] z = new int[N-1];

int ans  = 1000000000;
for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
}

		System.out.println(ans);
		keyboard.close();
	 	} Scanner keyboard = new Scanner(System.in); keyboard new Scanner(System.in) int N = keyboard.nextInt(); N keyboard.nextInt() keyboard.nextInt keyboard int sumW = 0; sumW 0 int[] s1 = new int[N]; s1 new int[N] N for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
} int i =0; int i =0; i 0 i<N i N i++ i++ i {
sumW += keyboard.nextInt(); 
s1[i] = sumW;
} {
sumW += keyboard.nextInt(); 
s1[i] = sumW;
} sumW += keyboard.nextInt() sumW keyboard.nextInt() keyboard.nextInt keyboard s1[i] = sumW s1[i] s1 i sumW int[] z = new int[N-1]; z new int[N-1] N-1 N 1 int ans  = 1000000000; ans 1000000000 for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
} int j =0; int j =0; j 0 j<N-1 j N-1 N 1 j++ j++ j {
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
} {
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
} ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans) ans Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans) Math.min Math Math.abs((sumW - s1[j]) - s1[j]) Math.abs Math (sumW - s1[j]) - s1[j] (sumW - s1[j]) sumW s1[j] s1 j s1[j] s1 j ans System.out.println(ans) System.out.println System.out System System.out ans keyboard.close() keyboard.close keyboard String[] args args public class Main { public static void main(String[] args) { 
Scanner keyboard = new Scanner(System.in); 

int N = keyboard.nextInt(); 

int sumW = 0;
int[] s1 = new int[N];

for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
}

int[] z = new int[N-1];

int ans  = 1000000000;
for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
}

		System.out.println(ans);
		keyboard.close();
	 	}
 } public class Main { public static void main(String[] args) { 
Scanner keyboard = new Scanner(System.in); 

int N = keyboard.nextInt(); 

int sumW = 0;
int[] s1 = new int[N];

for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
}

int[] z = new int[N-1];

int ans  = 1000000000;
for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
}

		System.out.println(ans);
		keyboard.close();
	 	}
 } Main
import java.util.Arrays; 
import java.util.Scanner; 
public class Main { public static void main(String[] args) { 
Scanner keyboard = new Scanner(System.in); 

int N = keyboard.nextInt(); 

int sumW = 0;
int[] s1 = new int[N];

for(int i =0; i<N; i++){
sumW += keyboard.nextInt(); 
s1[i] = sumW;
}

int[] z = new int[N-1];

int ans  = 1000000000;
for(int j =0; j<N-1; j++){
ans = Math.min(Math.abs((sumW - s1[j]) - s1[j]), ans);
}

		System.out.println(ans);
		keyboard.close();
	 	}
 } 
