
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

      for (int i = 0;i<n ;i++ ) {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      }
      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[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

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

  } Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

      for (int i = 0;i<n ;i++ ) {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      }
      System.out.println(min);
    } main {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

      for (int i = 0;i<n ;i++ ) {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      }
      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[] data = new int[n]; data new int[n] n int[] data2 = new int[n]; data2 new int[n] n int min=100; min 100 for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
      data[i] = sc.nextInt();
    } {
      data[i] = sc.nextInt();
    } data[i] = sc.nextInt() data[i] data i sc.nextInt() sc.nextInt sc data2[0]=data[0] data2[0] data2 0 data[0] data 0 for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      } int t = 1; int t = 1; t 1 t<n t n t++ t++ t {
      data2[t] = data2[t-1]+data[t];
      } {
      data2[t] = data2[t-1]+data[t];
      } data2[t] = data2[t-1]+data[t] data2[t] data2 t data2[t-1]+data[t] data2[t-1] data2 t-1 t 1 data[t] data t for (int i = 0;i<n ;i++ ) {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      } {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      } int t1 = data2[n-1]-data2[i]; t1 data2[n-1]-data2[i] data2[n-1] data2 n-1 n 1 data2[i] data2 i int t0 = data2[i]; t0 data2[i] data2 i int pre = Math.abs(t1-t0); pre Math.abs(t1-t0) Math.abs Math t1-t0 t1 t0 min = Math.min(min,pre) min Math.min(min,pre) Math.min Math min pre 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[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

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

  } public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

      for (int i = 0;i<n ;i++ ) {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      }
      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[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

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

  }
