import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] w = new Integer[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        }

        int result = 100;
        for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        }
        System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] w = new Integer[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        }

        int result = 100;
        for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        }
        System.out.println(result);
    }
} Main public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] w = new Integer[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        }

        int result = 100;
        for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        }
        System.out.println(result);
    } main {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] w = new Integer[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        }

        int result = 100;
        for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        }
        System.out.println(result);
    } 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 Integer[] w = new Integer[n]; w new Integer[n] n for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n 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 result = 100; result 100 for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        } {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        } int s1 = 0; s1 0 for (int j = 0; j < i; j++) {
                s1 += w[j];
            } int j = 0; int j = 0; j 0 j < i j i j++ j++ j {
                s1 += w[j];
            } {
                s1 += w[j];
            } s1 += w[j] s1 w[j] w j int s2 = 0; s2 0 for (int j = i; j < n; j++) {
                s2 += w[j];
            } int j = i; int j = i; j i j < n j n j++ j++ j {
                s2 += w[j];
            } {
                s2 += w[j];
            } s2 += w[j] s2 w[j] w j result = Math.min(result, Math.abs(s1 - s2)) result Math.min(result, Math.abs(s1 - s2)) Math.min Math result Math.abs(s1 - s2) Math.abs Math s1 - s2 s1 s2 System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] w = new Integer[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        }

        int result = 100;
        for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        }
        System.out.println(result);
    }
} public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] w = new Integer[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        }

        int result = 100;
        for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        }
        System.out.println(result);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] w = new Integer[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
        }

        int result = 100;
        for (int i = 1; i < n; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += w[j];
            }
            int s2 = 0;
            for (int j = i; j < n; j++) {
                s2 += w[j];
            }
            result = Math.min(result, Math.abs(s1 - s2));
        }
        System.out.println(result);
    }
}