import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N =sc.nextInt();
    int A[] =new int [N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();}
    int z=0;
      for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);}
    int x=0;
    for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}}
    System.out.println(x);
  }
} 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 A[] =new int [N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();}
    int z=0;
      for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);}
    int x=0;
    for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}}
    System.out.println(x);
  }
} Main public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N =sc.nextInt();
    int A[] =new int [N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();}
    int z=0;
      for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);}
    int x=0;
    for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}}
    System.out.println(x);
  } main {
    Scanner sc=new Scanner(System.in);
    int N =sc.nextInt();
    int A[] =new int [N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();}
    int z=0;
      for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);}
    int x=0;
    for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}}
    System.out.println(x);
  } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N =sc.nextInt(); N sc.nextInt() sc.nextInt sc int A[] =new int [N]; A new int [N] N for(int i=0;i<N;i++){
      A[i]=sc.nextInt();} int i=0; int i=0; i 0 i<N i N i++ i++ i {
      A[i]=sc.nextInt();} {
      A[i]=sc.nextInt();} A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int z=0; z 0 for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);} int k=0; int k=0; k 0 k<N k N k++ k++ k {
        z=z+(A[k])*(A[k]);} {
        z=z+(A[k])*(A[k]);} z=z+(A[k])*(A[k]) z z+(A[k])*(A[k]) z (A[k])*(A[k]) (A[k]) A k (A[k]) A k int x=0; x 0 for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}} int j=1; int j=1; j 1 j<=100 j 100 j++ j++ j {
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}} {
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}} int y=0; y 0 for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);} int m=0; int m=0; m 0 m<N m N m++ m++ m {
        y=y+(A[m]-j)*(A[m]-j);} {
        y=y+(A[m]-j)*(A[m]-j);} y=y+(A[m]-j)*(A[m]-j) y y+(A[m]-j)*(A[m]-j) y (A[m]-j)*(A[m]-j) (A[m]-j) A[m] A m j (A[m]-j) A[m] A m j z=Math.min(z,y) z Math.min(z,y) Math.min Math z y if(z==y){x=y;} z==y z y {x=y;} x=y x y System.out.println(x) System.out.println System.out System System.out x String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N =sc.nextInt();
    int A[] =new int [N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();}
    int z=0;
      for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);}
    int x=0;
    for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}}
    System.out.println(x);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N =sc.nextInt();
    int A[] =new int [N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();}
    int z=0;
      for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);}
    int x=0;
    for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}}
    System.out.println(x);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N =sc.nextInt();
    int A[] =new int [N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();}
    int z=0;
      for(int k=0;k<N;k++){
        z=z+(A[k])*(A[k]);}
    int x=0;
    for(int j=1;j<=100;j++){
      int y=0;
      for(int m=0;m<N;m++){
        y=y+(A[m]-j)*(A[m]-j);}
      z=Math.min(z,y);
      if(z==y){x=y;}}
    System.out.println(x);
  }
}