import java.util.Scanner;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int min = 100;
        for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        }
        System.out.println(min);
    }

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

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int min = 100;
        for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        }
        System.out.println(min);
    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int min = 100;
        for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        }
        System.out.println(min);
    } main {
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int min = 100;
        for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        }
        System.out.println(min);
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] w = new int[n]; w new int[n] n for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            w[i] = sc.nextInt();
        } {
            w[i] = sc.nextInt();
        } w[i] = sc.nextInt() w[i] w i sc.nextInt() sc.nextInt sc int s1 = 0; s1 0 int s2 = 0; s2 0 int min = 100; min 100 for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        } {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        } s1 += w[i] s1 w[i] w i if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            } i == 0 i 0 {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                } int t = i+1; int t = i+1; t i+1 i 1 t < n t n t++ t++ t {
                    s2 += w[t];
                } {
                    s2 += w[t];
                } s2 += w[t] s2 w[t] w t {
                s2 -= w[i];
            } s2 -= w[i] s2 w[i] w i int sum = s2 - s1; sum s2 - s1 s2 s1 if (sum < 0) {
                sum = -sum;
            } sum < 0 sum 0 {
                sum = -sum;
            } sum = -sum sum -sum sum if (sum < min) {
                min = sum;
            } sum < min sum min {
                min = sum;
            } min = sum min sum System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int min = 100;
        for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        }
        System.out.println(min);
    }

} public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int min = 100;
        for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        }
        System.out.println(min);
    }

} Main
import java.util.Scanner;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int min = 100;
        for (int i = 0; i < n; i++) {
            s1 += w[i];
            if (i == 0) {
                for (int t = i+1; t < n; t++) {
                    s2 += w[t];
                }
            } else {
                s2 -= w[i];
            }
            int sum = s2 - s1;
            if (sum < 0) {
                sum = -sum;
            }
            if (sum < min) {
                min = sum;
            }
        }
        System.out.println(min);
    }

}
