import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] w = new int[n];
		for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		}
		int ans = 100;
		for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		}
		System.out.println(ans);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] w = new int[n];
		for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		}
		int ans = 100;
		for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		}
		System.out.println(ans);
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] w = new int[n];
		for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		}
		int ans = 100;
		for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		}
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] w = new int[n];
		for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		}
		int ans = 100;
		for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		}
		System.out.println(ans);
		sc.close();
	} 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 int[] w = new int[n]; w new int[n] n for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		} int i = 0; int i = 0; i 0 i < w.length i w.length w w.length i++ i++ i {
			w[i] = Integer.parseInt(sc.next());
		} {
			w[i] = Integer.parseInt(sc.next());
		} w[i] = Integer.parseInt(sc.next()) w[i] w i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = 100; ans 100 for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		} {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		} int less = 0; less 0 int more = 0; more 0 for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			} int j = 0; int j = 0; j 0 j < w.length j w.length w w.length j++ j++ j {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			} {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			} if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				} j <= i j i {
					less += w[j];
				} less += w[j] less w[j] w j {
					more += w[j];
				} more += w[j] more w[j] w j ans = Math.min(ans, Math.abs(more - less)) ans Math.min(ans, Math.abs(more - less)) Math.min Math ans Math.abs(more - less) Math.abs Math more - less more less System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] w = new int[n];
		for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		}
		int ans = 100;
		for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		}
		System.out.println(ans);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] w = new int[n];
		for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		}
		int ans = 100;
		for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		}
		System.out.println(ans);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] w = new int[n];
		for (int i = 0; i < w.length; i++) {
			w[i] = Integer.parseInt(sc.next());
		}
		int ans = 100;
		for (int i = 0; i < n; i++) {
			int less = 0;
			int more = 0;
			for (int j = 0; j < w.length; j++) {
				if (j <= i) {
					less += w[j];
				} else {
					more += w[j];
				}
			}
			ans = Math.min(ans, Math.abs(more - less));
		}
		System.out.println(ans);
		sc.close();
	}
}