import java.util.*;
public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int data1[] = new int[n];
    int data2[] = new int[n + 1];

    int min = 100;




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


    for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    }


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


    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 data1[] = new int[n];
    int data2[] = new int[n + 1];

    int min = 100;




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


    for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    }


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


    System.out.println(min);

  }
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int data1[] = new int[n];
    int data2[] = new int[n + 1];

    int min = 100;




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


    for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    }


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


    System.out.println(min);

  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int data1[] = new int[n];
    int data2[] = new int[n + 1];

    int min = 100;




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


    for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    }


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


    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 data1[] = new int[n]; data1 new int[n] n int data2[] = new int[n + 1]; data2 new int[n + 1] n + 1 n 1 int min = 100; min 100 for (int i = 0 ; i < n ; i++) {
      data1[i] = sc.nextInt();
    } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
      data1[i] = sc.nextInt();
    } {
      data1[i] = sc.nextInt();
    } data1[i] = sc.nextInt() data1[i] data1 i sc.nextInt() sc.nextInt sc for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    } int i = 1 ; int i = 1 ; i 1 i < n + 1 i n + 1 n 1 i++ i++ i {
      data2[i] = data2[i-1] + data1[i-1] ;
    } {
      data2[i] = data2[i-1] + data1[i-1] ;
    } data2[i] = data2[i-1] + data1[i-1] data2[i] data2 i data2[i-1] + data1[i-1] data2[i-1] data2 i-1 i 1 data1[i-1] data1 i-1 i 1 for (int i = 0 ; i < n+1 ; i++ ) {
      //System.out.println(data2[n] - data2[i] - data2[i]);
      int s1 = data2[i];
      int s2 = data2[n] - data2[i];
      int abs = Math.abs(s1-s2);
      min = Math.min(min,abs);
    } int i = 0 ; int i = 0 ; i 0 i < n+1 i n+1 n 1 i++ i++ i {
      //System.out.println(data2[n] - data2[i] - data2[i]);
      int s1 = data2[i];
      int s2 = data2[n] - data2[i];
      int abs = Math.abs(s1-s2);
      min = Math.min(min,abs);
    } {
      //System.out.println(data2[n] - data2[i] - data2[i]);
      int s1 = data2[i];
      int s2 = data2[n] - data2[i];
      int abs = Math.abs(s1-s2);
      min = Math.min(min,abs);
    } int s1 = data2[i]; s1 data2[i] data2 i int s2 = data2[n] - data2[i]; s2 data2[n] - data2[i] data2[n] data2 n data2[i] data2 i int abs = Math.abs(s1-s2); abs Math.abs(s1-s2) Math.abs Math s1-s2 s1 s2 min = Math.min(min,abs) min Math.min(min,abs) Math.min Math min abs 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 data1[] = new int[n];
    int data2[] = new int[n + 1];

    int min = 100;




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


    for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    }


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


    System.out.println(min);

  }
} public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int data1[] = new int[n];
    int data2[] = new int[n + 1];

    int min = 100;




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


    for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    }


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


    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 data1[] = new int[n];
    int data2[] = new int[n + 1];

    int min = 100;




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


    for (int i = 1 ; i < n + 1 ; i++ ) {
      data2[i] = data2[i-1] + data1[i-1] ;
    }


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


    System.out.println(min);

  }
}
