import 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 gap = 0;
    int min = 100;


    for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    }
    System.out.println(min);
  }

} 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[] w = new int[n];

    for (int i = 0; i < n; i++) {
      w[i] = sc.nextInt();
    }

    int gap = 0;
    int min = 100;


    for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    }
    System.out.println(min);
  }

} 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 gap = 0;
    int min = 100;


    for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    }
    System.out.println(min);
  } 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 gap = 0;
    int min = 100;


    for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    }
    System.out.println(min);
  } 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 gap = 0; gap 0 int min = 100; min 100 for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    } int t = 1; int t = 1; t 1 t < n t n t++ t++ t {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    } {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    } int total1 = 0; total1 0 int total2 = 0; total2 0 for (int j = 0; j < t; j++) {
        total1 += w[j];
      } int j = 0; int j = 0; j 0 j < t j t j++ j++ j {
        total1 += w[j];
      } {
        total1 += w[j];
      } total1 += w[j] total1 w[j] w j for (int k = t; k < n; k++) {
        total2 += w[k];
      } int k = t; int k = t; k t k < n k n k++ k++ k {
        total2 += w[k];
      } {
        total2 += w[k];
      } total2 += w[k] total2 w[k] w k gap = Math.abs(total2 - total1) gap Math.abs(total2 - total1) Math.abs Math total2 - total1 total2 total1 min = Math.min(min,gap) min Math.min(min,gap) Math.min Math min gap System.out.println(min) System.out.println System.out System System.out min 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 gap = 0;
    int min = 100;


    for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    }
    System.out.println(min);
  }

} 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 gap = 0;
    int min = 100;


    for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    }
    System.out.println(min);
  }

} Main
import 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 gap = 0;
    int min = 100;


    for (int t = 1; t < n; t++) {
      int total1 = 0;
      int total2 = 0;
      for (int j = 0; j < t; j++) {
        total1 += w[j];
      }
      for (int k = t; k < n; k++) {
        total2 += w[k];
      }
      gap = Math.abs(total2 - total1);
      min = Math.min(min,gap);
    }
    System.out.println(min);
  }

}
