import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] K = new int[N];
    int ans = Integer.MAX_VALUE;
    for(int i=0; i<N; i++){
      K[i] = sc.nextInt();
    }
    for(int i=1; i<=100; i++){
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    }
    System.out.print(ans);
  }
}
    
       
     import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] K = new int[N];
    int ans = Integer.MAX_VALUE;
    for(int i=0; i<N; i++){
      K[i] = sc.nextInt();
    }
    for(int i=1; i<=100; i++){
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    }
    System.out.print(ans);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] K = new int[N];
    int ans = Integer.MAX_VALUE;
    for(int i=0; i<N; i++){
      K[i] = sc.nextInt();
    }
    for(int i=1; i<=100; i++){
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    }
    System.out.print(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] K = new int[N];
    int ans = Integer.MAX_VALUE;
    for(int i=0; i<N; i++){
      K[i] = sc.nextInt();
    }
    for(int i=1; i<=100; i++){
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    }
    System.out.print(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] K = new int[N]; K new int[N] N int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0; i<N; i++){
      K[i] = sc.nextInt();
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      K[i] = sc.nextInt();
    } {
      K[i] = sc.nextInt();
    } K[i] = sc.nextInt() K[i] K i sc.nextInt() sc.nextInt sc for(int i=1; i<=100; i++){
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    } int i=1; int i=1; i 1 i<=100 i 100 i++ i++ i {
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    } {
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    } int sum = 0; sum 0 for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      } int j=0; int j=0; j 0 j<N j N j++ j++ j {
        sum += Math.pow(K[j]-i, 2);
      } {
        sum += Math.pow(K[j]-i, 2);
      } sum += Math.pow(K[j]-i, 2) sum Math.pow(K[j]-i, 2) Math.pow Math K[j]-i K[j] K j i 2 ans = Math.min(ans, sum) ans Math.min(ans, sum) Math.min Math ans sum System.out.print(ans) System.out.print System.out System System.out ans String[] args args
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] K = new int[N];
    int ans = Integer.MAX_VALUE;
    for(int i=0; i<N; i++){
      K[i] = sc.nextInt();
    }
    for(int i=1; i<=100; i++){
      int sum = 0;
      for(int j=0; j<N; j++){
        sum += Math.pow(K[j]-i, 2);
      }
      ans = Math.min(ans, sum);
    }
    System.out.print(ans);
  }
}
    
       
    
