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();

    int minDiff = 100 * n;

    for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    }

    System.out.println(minDiff);
  }
} 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();

    int minDiff = 100 * n;

    for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    }

    System.out.println(minDiff);
  }
} 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();

    int minDiff = 100 * n;

    for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    }

    System.out.println(minDiff);
  } 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();

    int minDiff = 100 * n;

    for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    }

    System.out.println(minDiff);
  } 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] w i sc.nextInt() sc.nextInt sc int minDiff = 100 * n; minDiff 100 * n 100 n for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    } int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 ++i ++i i {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    } {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    } int s1 = 0 s1 0 s2 = 0; s2 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] w j for (int j = i + 1; j < n; ++j)
        s2 += w[j]; int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n ++j ++j j s2 += w[j]; s2 += w[j] s2 w[j] w j int diff = Math.abs(s2 - s1); diff Math.abs(s2 - s1) Math.abs Math s2 - s1 s2 s1 minDiff = (diff < minDiff) ? diff : minDiff minDiff (diff < minDiff) ? diff : minDiff (diff < minDiff) diff minDiff diff minDiff System.out.println(minDiff) System.out.println System.out System System.out minDiff 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();

    int minDiff = 100 * n;

    for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    }

    System.out.println(minDiff);
  }
} 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();

    int minDiff = 100 * n;

    for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    }

    System.out.println(minDiff);
  }
} 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();

    int minDiff = 100 * n;

    for (int i = 0; i < n - 1; ++i) {
      int s1 = 0, s2 = 0;

      for (int j = 0; j <= i; ++j)
        s1 += w[j];
      for (int j = i + 1; j < n; ++j)
        s2 += w[j];

      int diff = Math.abs(s2 - s1);
      minDiff = (diff < minDiff) ? diff : minDiff;
    }

    System.out.println(minDiff);
  }
}