import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] X = new int[N];
    double t = 0;
    for (int i = 0; i < N; i++) {
      X[i] = sc.nextInt();
      t += X[i]; 
    }
    int ave = (int)Math.round(t/N);
    int n = 0;    
    for (int i = 0; i < N; i++) {
      n += Math.pow(ave-X[i],2); 
    }
    System.out.println(n);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] X = new int[N];
    double t = 0;
    for (int i = 0; i < N; i++) {
      X[i] = sc.nextInt();
      t += X[i]; 
    }
    int ave = (int)Math.round(t/N);
    int n = 0;    
    for (int i = 0; i < N; i++) {
      n += Math.pow(ave-X[i],2); 
    }
    System.out.println(n);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] X = new int[N];
    double t = 0;
    for (int i = 0; i < N; i++) {
      X[i] = sc.nextInt();
      t += X[i]; 
    }
    int ave = (int)Math.round(t/N);
    int n = 0;    
    for (int i = 0; i < N; i++) {
      n += Math.pow(ave-X[i],2); 
    }
    System.out.println(n);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] X = new int[N];
    double t = 0;
    for (int i = 0; i < N; i++) {
      X[i] = sc.nextInt();
      t += X[i]; 
    }
    int ave = (int)Math.round(t/N);
    int n = 0;    
    for (int i = 0; i < N; i++) {
      n += Math.pow(ave-X[i],2); 
    }
    System.out.println(n);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] X = new int[N]; X new int[N] N double t = 0; t 0 for (int i = 0; i < N; i++) {
      X[i] = sc.nextInt();
      t += X[i]; 
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      X[i] = sc.nextInt();
      t += X[i]; 
    } {
      X[i] = sc.nextInt();
      t += X[i]; 
    } X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc t += X[i] t X[i] X i int ave = (int)Math.round(t/N); ave (int)Math.round(t/N) Math.round Math t/N t N int n = 0; n 0 for (int i = 0; i < N; i++) {
      n += Math.pow(ave-X[i],2); 
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      n += Math.pow(ave-X[i],2); 
    } {
      n += Math.pow(ave-X[i],2); 
    } n += Math.pow(ave-X[i],2) n Math.pow(ave-X[i],2) Math.pow Math ave-X[i] ave X[i] X i 2 System.out.println(n) System.out.println System.out System System.out n String[] args args
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] X = new int[N];
    double t = 0;
    for (int i = 0; i < N; i++) {
      X[i] = sc.nextInt();
      t += X[i]; 
    }
    int ave = (int)Math.round(t/N);
    int n = 0;    
    for (int i = 0; i < N; i++) {
      n += Math.pow(ave-X[i],2); 
    }
    System.out.println(n);
  }
}