import java.util.*;
import java.util.Map.Entry;
 
class Main {
//	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
//       int B = sc.nextInt();
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
       int ans=Integer.MAX_VALUE;
       for(int i=0;i<=100;i++) {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       }
       
       
       System.out.println(ans);
   }
      
} import java.util.*; util.* java import java.util.Map.Entry; Entry java.util.Map class Main {
//	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
//       int B = sc.nextInt();
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
       int ans=Integer.MAX_VALUE;
       for(int i=0;i<=100;i++) {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       }
       
       
       System.out.println(ans);
   }
      
} Main //	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
//       int B = sc.nextInt();
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
       int ans=Integer.MAX_VALUE;
       for(int i=0;i<=100;i++) {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       }
       
       
       System.out.println(ans);
   } main {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
//       int B = sc.nextInt();
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
       int ans=Integer.MAX_VALUE;
       for(int i=0;i<=100;i++) {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       }
       
       
       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 long[] a = new long[(int)N]; a new long[(int)N] (int)N for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       } int i=0 ; int i=0 ; i 0 i<N i N i++ i++ i {
           a[i] = sc.nextLong();
       } {
           a[i] = sc.nextLong();
       } a[i] = sc.nextLong() a[i] a i sc.nextLong() sc.nextLong sc int ans=Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<=100;i++) {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       } int i=0; int i=0; i 0 i<=100 i 100 i++ i++ i {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       } {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       } int sum=0; sum 0 for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   } int j=0; int j=0; j 0 j<N j N j++ j++ j {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   } {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   } sum=(int) (sum+Math.pow(a[j]-i,2)) sum (int) (sum+Math.pow(a[j]-i,2)) sum Math.pow(a[j]-i,2) Math.pow Math a[j]-i a[j] a j i 2 ans=Math.min(ans, sum) ans Math.min(ans, sum) Math.min Math ans sum System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
import java.util.Map.Entry;
 
class Main {
//	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
//       int B = sc.nextInt();
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
       int ans=Integer.MAX_VALUE;
       for(int i=0;i<=100;i++) {
    	   int sum=0;
    	   for(int j=0;j<N;j++) {
    		   sum=(int) (sum+Math.pow(a[j]-i,2));
    	   }
    	   ans=Math.min(ans, sum);
       }
       
       
       System.out.println(ans);
   }
      
}