import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x[] = new int[n];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    int mindis = 200000000;
    int minplace = -1;
    for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    }
    System.out.println(ans);
  }
} 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 x[] = new int[n];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    int mindis = 200000000;
    int minplace = -1;
    for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x[] = new int[n];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    int mindis = 200000000;
    int minplace = -1;
    for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x[] = new int[n];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    int mindis = 200000000;
    int minplace = -1;
    for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    }
    System.out.println(ans);
  } 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 for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
      x[i] = sc.nextInt();
    } {
      x[i] = sc.nextInt();
    } x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc int mindis = 200000000; mindis 200000000 int minplace = -1; minplace -1 1 for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    } int i = 0; int i = 0; i 0 i<101 i 101 i++ i++ i {
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    } {
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    } int dis = 0; dis 0 for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      } int j = 0; int j = 0; j 0 j<n j n j++ j++ j {
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      } {
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      } dis += Math.abs(x[j] - i) * Math.abs(x[j] - i) dis Math.abs(x[j] - i) * Math.abs(x[j] - i) Math.abs(x[j] - i) Math.abs Math x[j] - i x[j] x j i Math.abs(x[j] - i) Math.abs Math x[j] - i x[j] x j i if(dis < mindis){
        mindis = dis;
        minplace = i;
      } dis < mindis dis mindis {
        mindis = dis;
        minplace = i;
      } mindis = dis mindis dis minplace = i minplace i int ans = 0; ans 0 for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
      ans += (x[i] - minplace) * (x[i] - minplace);
    } {
      ans += (x[i] - minplace) * (x[i] - minplace);
    } ans += (x[i] - minplace) * (x[i] - minplace) ans (x[i] - minplace) * (x[i] - minplace) (x[i] - minplace) x[i] x i minplace (x[i] - minplace) x[i] x i minplace 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){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x[] = new int[n];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    int mindis = 200000000;
    int minplace = -1;
    for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    }
    System.out.println(ans);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x[] = new int[n];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    int mindis = 200000000;
    int minplace = -1;
    for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    }
    System.out.println(ans);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x[] = new int[n];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    int mindis = 200000000;
    int minplace = -1;
    for(int i = 0;i<101;i++){
      int dis = 0;
      for(int j = 0;j<n;j++){
        dis += Math.abs(x[j] - i) * Math.abs(x[j] - i);
      }
      if(dis < mindis){
        mindis = dis;
        minplace = i;
      }
    }
    int ans = 0;
    for(int i = 0;i<n;i++){
      ans += (x[i] - minplace) * (x[i] - minplace);
    }
    System.out.println(ans);
  }
}
