import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
            int N=sc.nextInt();
            int X[] =new int[N];
            int total=0;
            for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            }
            long C = Math.round((double)total/N);
            int ans=0;
            
            for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            }
        
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
            int N=sc.nextInt();
            int X[] =new int[N];
            int total=0;
            for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            }
            long C = Math.round((double)total/N);
            int ans=0;
            
            for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            }
        
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
            int N=sc.nextInt();
            int X[] =new int[N];
            int total=0;
            for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            }
            long C = Math.round((double)total/N);
            int ans=0;
            
            for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            }
        
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
            int N=sc.nextInt();
            int X[] =new int[N];
            int total=0;
            for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            }
            long C = Math.round((double)total/N);
            int ans=0;
            
            for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            }
        
        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 int X[] =new int[N]; X new int[N] N int total=0; total 0 for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            } int i=0; int i=0; i 0 i<N i N i++ i++ i {
                X[i]=sc.nextInt();
                total+=X[i];
            } {
                X[i]=sc.nextInt();
                total+=X[i];
            } X[i]=sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc total+=X[i] total X[i] X i long C = Math.round((double)total/N); C Math.round((double)total/N) Math.round Math (double)total/N (double)total N int ans=0; ans 0 for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            } int j=0; int j=0; j 0 j<N j N j++ j++ j {
                ans += Math.pow(X[j]-C, 2);
            } {
                ans += Math.pow(X[j]-C, 2);
            } ans += Math.pow(X[j]-C, 2) ans Math.pow(X[j]-C, 2) Math.pow Math X[j]-C X[j] X j C 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
            int N=sc.nextInt();
            int X[] =new int[N];
            int total=0;
            for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            }
            long C = Math.round((double)total/N);
            int ans=0;
            
            for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            }
        
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
            int N=sc.nextInt();
            int X[] =new int[N];
            int total=0;
            for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            }
            long C = Math.round((double)total/N);
            int ans=0;
            
            for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            }
        
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
            int N=sc.nextInt();
            int X[] =new int[N];
            int total=0;
            for(int i=0;i<N;i++){
                X[i]=sc.nextInt();
                total+=X[i];
            }
            long C = Math.round((double)total/N);
            int ans=0;
            
            for(int j=0;j<N;j++){
                ans += Math.pow(X[j]-C, 2);
            }
        
        System.out.println(ans);
    }
}
