import java.util.*;
class Main{
  static Scanner s = new Scanner(System.in);
  
  public static void main(String[] args){
    
    int N = s.nextInt();
    int[] X = new int[N];
    for(int i=0;i<N;i++) X[i] = s.nextInt();       
    Arrays.sort(X);
    int temp1 = 0;
    int temp2 = 0;

    for(int i=X[0];i<=X[N-1];i++){
      temp1 = 0;
      for(int j=0;j<N;j++){
        temp1 += Math.pow(X[j]-i,2);
      }
      if(i==X[0]) temp2 =temp1;
      else temp2=Math.min(temp1,temp2);
    }
    System.out.println(temp2);
  }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz