import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // Arrays.sort(w);
        int temp1 = 0;
        int ans = 100;
        for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // Arrays.sort(w);
        int temp1 = 0;
        int ans = 100;
        for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // Arrays.sort(w);
        int temp1 = 0;
        int ans = 100;
        for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // Arrays.sort(w);
        int temp1 = 0;
        int ans = 100;
        for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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 temp1 = 0; temp1 0 int ans = 100; ans 100 for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        } int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        } {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        } temp1 += w[i] temp1 w[i] w i int temp2 = 0; temp2 0 for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
                temp2 += w[j];
            } {
                temp2 += w[j];
            } temp2 += w[j] temp2 w[j] w j int tAns = Math.abs(temp1 - temp2); tAns Math.abs(temp1 - temp2) Math.abs Math temp1 - temp2 temp1 temp2 if (tAns < ans) {
                ans = tAns;
            } tAns < ans tAns ans {
                ans = tAns;
            } ans = tAns ans tAns System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // Arrays.sort(w);
        int temp1 = 0;
        int ans = 100;
        for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // Arrays.sort(w);
        int temp1 = 0;
        int ans = 100;
        for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // Arrays.sort(w);
        int temp1 = 0;
        int ans = 100;
        for (int i = 0; i < n - 1; i++) {
            temp1 += w[i];
            int temp2 = 0;
            for (int j = i + 1; j < n; j++) {
                temp2 += w[j];
            }
            int tAns = Math.abs(temp1 - temp2);
            if (tAns < ans) {
                ans = tAns;
            }
        }
        System.out.println(ans);
    }
}