import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] x = new int[n];
    int x_max = 0;
    int x_min = 100;
    int ans = 1000000000;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    }
    for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    }
    System.out.println(ans);
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] x = new int[n];
    int x_max = 0;
    int x_min = 100;
    int ans = 1000000000;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    }
    for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] x = new int[n];
    int x_max = 0;
    int x_min = 100;
    int ans = 1000000000;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    }
    for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    }
    System.out.println(ans);
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] x = new int[n];
    int x_max = 0;
    int x_min = 100;
    int ans = 1000000000;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    }
    for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    }
    System.out.println(ans);
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(in.readLine()); n Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in String[] str = in.readLine().split(" "); str in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int[] x = new int[n]; x new int[n] n int x_max = 0; x_max 0 int x_min = 100; x_min 100 int ans = 1000000000; ans 1000000000 for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    } {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    } x[i] = Integer.parseInt(str[i]) x[i] x i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i x_max = Math.max(x_max,x[i]) x_max Math.max(x_max,x[i]) Math.max Math x_max x[i] x i x_min = Math.min(x_min,x[i]) x_min Math.min(x_min,x[i]) Math.min Math x_min x[i] x i for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    } int i=x_min; int i=x_min; i x_min i<=x_max i x_max i++ i++ i {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    } {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    } int sum = 0; sum 0 for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      } int j=0; int j=0; j 0 j<n j n j++ j++ j {
        sum += Math.pow((x[j]-i),2);
      } {
        sum += Math.pow((x[j]-i),2);
      } sum += Math.pow((x[j]-i),2) sum Math.pow((x[j]-i),2) Math.pow Math (x[j]-i) x[j] x j i 2 ans = Math.min(sum,ans) ans Math.min(sum,ans) Math.min Math sum ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] x = new int[n];
    int x_max = 0;
    int x_min = 100;
    int ans = 1000000000;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    }
    for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    }
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] x = new int[n];
    int x_max = 0;
    int x_min = 100;
    int ans = 1000000000;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    }
    for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    }
    System.out.println(ans);
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] x = new int[n];
    int x_max = 0;
    int x_min = 100;
    int ans = 1000000000;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      x_max = Math.max(x_max,x[i]);
      x_min = Math.min(x_min,x[i]);
    }
    for(int i=x_min; i<=x_max; i++) {
      int sum = 0;
      for(int j=0; j<n; j++) {
        sum += Math.pow((x[j]-i),2);
      }
      ans = Math.min(sum,ans);
    }
    System.out.println(ans);
  }
}