import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int b = 1000000;
		int c = 0;
        for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        }       
		System.out.println(b);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int b = 1000000;
		int c = 0;
        for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        }       
		System.out.println(b);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int b = 1000000;
		int c = 0;
        for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        }       
		System.out.println(b);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int b = 1000000;
		int c = 0;
        for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        }       
		System.out.println(b);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int [] in = new int [a]; in new int [a] a for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            } int i=0; int i=0; i 0 i<a i a i++ i++ i {
                             in[i] = sc.nextInt();
                            } {
                             in[i] = sc.nextInt();
                            } in[i] = sc.nextInt() in[i] in i sc.nextInt() sc.nextInt sc int b = 1000000; b 1000000 int c = 0; c 0 for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        } int i=1; int i=1; i 1 i<=100 i 100 i++ i++ i {
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        } {
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        } for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              } int j=0; int j=0; j 0 j<a j a j++ j++ j {c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              } {c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              } c+=(in[j]-i)*(in[j]-i) c (in[j]-i)*(in[j]-i) (in[j]-i) in[j] in j i (in[j]-i) in[j] in j i if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         } j==a-1 j a-1 a 1 {b=Math.min(b,c);
                                          c=0;                                                
                                         } b=Math.min(b,c) b Math.min(b,c) Math.min Math b c c=0 c 0 System.out.println(b) System.out.println System.out System System.out b String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int b = 1000000;
		int c = 0;
        for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        }       
		System.out.println(b);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int b = 1000000;
		int c = 0;
        for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        }       
		System.out.println(b);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int b = 1000000;
		int c = 0;
        for(int i=1;i<=100;i++){
          for(int j=0;j<a;j++){c+=(in[j]-i)*(in[j]-i);
                               if(j==a-1){b=Math.min(b,c);
                                          c=0;                                                
                                         }                              
                              }                            
        }       
		System.out.println(b);
	}
}
