import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    } main {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    } 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 for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	} int i=0; int i=0; i 0 i<N i N i++ i++ i {
	    X[i] = sc.nextInt();
	} {
	    X[i] = sc.nextInt();
	} X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	} int p=1; int p=1; p 1 p<=100 p 100 p++ p++ p {
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	} {
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	} int count = 0; count 0 for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    } int j=0; int j=0; j 0 j<N j N j++ j++ j {
		count += (X[j] - p)*(X[j] - p);
	    } {
		count += (X[j] - p)*(X[j] - p);
	    } count += (X[j] - p)*(X[j] - p) count (X[j] - p)*(X[j] - p) (X[j] - p) X[j] X j p (X[j] - p) X[j] X j p if(count < min) min = count; count < min count min min = count min count System.out.print(min) System.out.print System.out System System.out min String[] args args public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    }
} public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    }
}
