import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int right, left;
        right = left = 0;
        ArrayList<Integer> w = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        }
        int min = 10000;
        left += w.get(0);
        right -= w.get(0);
        for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        }

        System.out.println(min);
        return;
    }


} 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 right, left;
        right = left = 0;
        ArrayList<Integer> w = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        }
        int min = 10000;
        left += w.get(0);
        right -= w.get(0);
        for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        }

        System.out.println(min);
        return;
    }


} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int right, left;
        right = left = 0;
        ArrayList<Integer> w = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        }
        int min = 10000;
        left += w.get(0);
        right -= w.get(0);
        for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        }

        System.out.println(min);
        return;
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int right, left;
        right = left = 0;
        ArrayList<Integer> w = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        }
        int min = 10000;
        left += w.get(0);
        right -= w.get(0);
        for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        }

        System.out.println(min);
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int right right left; left right = left = 0 right left = 0 left 0 ArrayList<Integer> w = new ArrayList<>(); w new ArrayList<>() for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        } {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        } int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc w.add(num) w.add w num right += num right num int min = 10000; min 10000 left += w.get(0) left w.get(0) w.get w 0 right -= w.get(0) right w.get(0) w.get w 0 for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        } {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        } if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            } min > Math.abs(left - right) min Math.abs(left - right) Math.abs Math left - right left right {
                min = Math.abs(left - right);
            } min = Math.abs(left - right) min Math.abs(left - right) Math.abs Math left - right left right left += w.get(i) left w.get(i) w.get w i right -= w.get(i) right w.get(i) w.get w i System.out.println(min) System.out.println System.out System System.out min return; String[] args args public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int right, left;
        right = left = 0;
        ArrayList<Integer> w = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        }
        int min = 10000;
        left += w.get(0);
        right -= w.get(0);
        for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        }

        System.out.println(min);
        return;
    }


} public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int right, left;
        right = left = 0;
        ArrayList<Integer> w = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        }
        int min = 10000;
        left += w.get(0);
        right -= w.get(0);
        for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        }

        System.out.println(min);
        return;
    }


} Main
import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int right, left;
        right = left = 0;
        ArrayList<Integer> w = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            w.add(num);
            right += num;
        }
        int min = 10000;
        left += w.get(0);
        right -= w.get(0);
        for (int i = 1; i < n; i++) {
            if (min > Math.abs(left - right)) {
                min = Math.abs(left - right);
            }
            left += w.get(i);
            right -= w.get(i);
        }

        System.out.println(min);
        return;
    }


}
