import java.util.*;
public class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] pos = new int[n];
   for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   }
   int min = Integer.MAX_VALUE;
   for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   }
   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[] pos = new int[n];
   for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   }
   int min = Integer.MAX_VALUE;
   for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   }
   System.out.println(""+min);
 }
} Main public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] pos = new int[n];
   for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   }
   int min = Integer.MAX_VALUE;
   for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   }
   System.out.println(""+min);
 } main {
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] pos = new int[n];
   for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   }
   int min = Integer.MAX_VALUE;
   for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   }
   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[] pos = new int[n]; pos new int[n] n for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   } int i=0; int i=0; i 0 i<n i n i++ i++ i {
     pos[i]=sc.nextInt();
   } {
     pos[i]=sc.nextInt();
   } pos[i]=sc.nextInt() pos[i] pos i sc.nextInt() sc.nextInt sc int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   } int i=0; int i=0; i 0 i<=100 i 100 i++ i++ i {
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   } {
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   } int total=0; total 0 for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     } int j=0; int j=0; j 0 j<n j n j++ j++ j {
       total+=(pos[j]-i)*(pos[j]-i);
     } {
       total+=(pos[j]-i)*(pos[j]-i);
     } total+=(pos[j]-i)*(pos[j]-i) total (pos[j]-i)*(pos[j]-i) (pos[j]-i) pos[j] pos j i (pos[j]-i) pos[j] pos j i if(total<min)min=total; total<min total min min=total min total System.out.println(""+min) System.out.println System.out System System.out ""+min "" min String args[] args public class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] pos = new int[n];
   for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   }
   int min = Integer.MAX_VALUE;
   for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   }
   System.out.println(""+min);
 }
} public class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] pos = new int[n];
   for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   }
   int min = Integer.MAX_VALUE;
   for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   }
   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[] pos = new int[n];
   for(int i=0;i<n;i++){
     pos[i]=sc.nextInt();
   }
   int min = Integer.MAX_VALUE;
   for(int i=0;i<=100;i++){
     int total=0;
     for(int j=0;j<n;j++){
       total+=(pos[j]-i)*(pos[j]-i);
     }
     if(total<min)min=total;
   }
   System.out.println(""+min);
 }
}