import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        float x[]=new float[n];
        float sum=0;
        for(int i=0; i<n; i++){
          x[i]=sc.nextFloat();
          sum+=x[i];
        }
        float p=Math.round(sum/n);
        float hp[]=new float[n];
        float ans=0;
        for(int j=0; j<n; j++){
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        }
        //double d=fl.doubleValue(ans);
        //int s=fl.intValue(d);
        System.out.print(Math.round(ans));
        sc.close();
    }
} import java.util.Scanner; Scanner java.util class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        float x[]=new float[n];
        float sum=0;
        for(int i=0; i<n; i++){
          x[i]=sc.nextFloat();
          sum+=x[i];
        }
        float p=Math.round(sum/n);
        float hp[]=new float[n];
        float ans=0;
        for(int j=0; j<n; j++){
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        }
        //double d=fl.doubleValue(ans);
        //int s=fl.intValue(d);
        System.out.print(Math.round(ans));
        sc.close();
    }
} Main public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        float x[]=new float[n];
        float sum=0;
        for(int i=0; i<n; i++){
          x[i]=sc.nextFloat();
          sum+=x[i];
        }
        float p=Math.round(sum/n);
        float hp[]=new float[n];
        float ans=0;
        for(int j=0; j<n; j++){
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        }
        //double d=fl.doubleValue(ans);
        //int s=fl.intValue(d);
        System.out.print(Math.round(ans));
        sc.close();
    } main {
		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        float x[]=new float[n];
        float sum=0;
        for(int i=0; i<n; i++){
          x[i]=sc.nextFloat();
          sum+=x[i];
        }
        float p=Math.round(sum/n);
        float hp[]=new float[n];
        float ans=0;
        for(int j=0; j<n; j++){
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        }
        //double d=fl.doubleValue(ans);
        //int s=fl.intValue(d);
        System.out.print(Math.round(ans));
        sc.close();
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc float x[]=new float[n]; x new float[n] n float sum=0; sum 0 for(int i=0; i<n; i++){
          x[i]=sc.nextFloat();
          sum+=x[i];
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
          x[i]=sc.nextFloat();
          sum+=x[i];
        } {
          x[i]=sc.nextFloat();
          sum+=x[i];
        } x[i]=sc.nextFloat() x[i] x i sc.nextFloat() sc.nextFloat sc sum+=x[i] sum x[i] x i float p=Math.round(sum/n); p Math.round(sum/n) Math.round Math sum/n sum n float hp[]=new float[n]; hp new float[n] n float ans=0; ans 0 for(int j=0; j<n; j++){
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        } int j=0; int j=0; j 0 j<n j n j++ j++ j {
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        } {
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        } hp[j]=(x[j]-p)*(x[j]-p) hp[j] hp j (x[j]-p)*(x[j]-p) (x[j]-p) x[j] x j p (x[j]-p) x[j] x j p ans+=hp[j] ans hp[j] hp j System.out.print(Math.round(ans)) System.out.print System.out System System.out Math.round(ans) Math.round Math ans sc.close() sc.close sc String args[] args
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        float x[]=new float[n];
        float sum=0;
        for(int i=0; i<n; i++){
          x[i]=sc.nextFloat();
          sum+=x[i];
        }
        float p=Math.round(sum/n);
        float hp[]=new float[n];
        float ans=0;
        for(int j=0; j<n; j++){
          hp[j]=(x[j]-p)*(x[j]-p);
          ans+=hp[j];
        }
        //double d=fl.doubleValue(ans);
        //int s=fl.intValue(d);
        System.out.print(Math.round(ans));
        sc.close();
    }
}
