import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int[] Xs= new int[N];
		for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		}
		int ans= 1_000_000_000;
		for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		}
		System.out.println(ans);
	}

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

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int[] Xs= new int[N];
		for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		}
		int ans= 1_000_000_000;
		for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int[] Xs= new int[N];
		for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		}
		int ans= 1_000_000_000;
		for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		}
		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[] Xs= new int[N]; Xs new int[N] N for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			Xs[i] = sc.nextInt();
		} {
			Xs[i] = sc.nextInt();
		} Xs[i] = sc.nextInt() Xs[i] Xs i sc.nextInt() sc.nextInt sc int ans= 1_000_000_000; ans 1_000_000_000 for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		} int i=1; int i=1; i 1 i<101 i 101 i++ i++ i {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		} {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		} int total = 0; total 0 for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			} int j=0; int j=0; j 0 j<N j N j++ j++ j {
				total += (int)Math.pow(Xs[j]-i, 2);
			} {
				total += (int)Math.pow(Xs[j]-i, 2);
			} total += (int)Math.pow(Xs[j]-i, 2) total (int)Math.pow(Xs[j]-i, 2) Math.pow Math Xs[j]-i Xs[j] Xs j i 2 ans = Integer.min(ans, total) ans Integer.min(ans, total) Integer.min Integer ans total 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) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int[] Xs= new int[N];
		for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		}
		int ans= 1_000_000_000;
		for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		}
		System.out.println(ans);
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int[] Xs= new int[N];
		for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		}
		int ans= 1_000_000_000;
		for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		}
		System.out.println(ans);
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int[] Xs= new int[N];
		for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		}
		int ans= 1_000_000_000;
		for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		}
		System.out.println(ans);
	}

}