import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X[] = new int[N];
		int a = 0;
		double b = 0;

		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		}
		double aa=a;
		double NN=N;
		sc.close();
		double A = Math.round(aa / NN);

		for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		}
		int c = (int) b;
		System.out.println(c);
	}
} 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 X[] = new int[N];
		int a = 0;
		double b = 0;

		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		}
		double aa=a;
		double NN=N;
		sc.close();
		double A = Math.round(aa / NN);

		for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		}
		int c = (int) b;
		System.out.println(c);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X[] = new int[N];
		int a = 0;
		double b = 0;

		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		}
		double aa=a;
		double NN=N;
		sc.close();
		double A = Math.round(aa / NN);

		for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		}
		int c = (int) b;
		System.out.println(c);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X[] = new int[N];
		int a = 0;
		double b = 0;

		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		}
		double aa=a;
		double NN=N;
		sc.close();
		double A = Math.round(aa / NN);

		for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		}
		int c = (int) b;
		System.out.println(c);
	} 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 a = 0; a 0 double b = 0; b 0 for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			X[i] = sc.nextInt();
			a += X[i];
		} {
			X[i] = sc.nextInt();
			a += X[i];
		} X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc a += X[i] a X[i] X i double aa=a; aa a double NN=N; NN N sc.close() sc.close sc double A = Math.round(aa / NN); A Math.round(aa / NN) Math.round Math aa / NN aa NN for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			b += Math.pow((X[i] - A), 2);
		} {
			b += Math.pow((X[i] - A), 2);
		} b += Math.pow((X[i] - A), 2) b Math.pow((X[i] - A), 2) Math.pow Math (X[i] - A) X[i] X i A 2 int c = (int) b; c (int) b System.out.println(c) System.out.println System.out System System.out c 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];
		int a = 0;
		double b = 0;

		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		}
		double aa=a;
		double NN=N;
		sc.close();
		double A = Math.round(aa / NN);

		for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		}
		int c = (int) b;
		System.out.println(c);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X[] = new int[N];
		int a = 0;
		double b = 0;

		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		}
		double aa=a;
		double NN=N;
		sc.close();
		double A = Math.round(aa / NN);

		for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		}
		int c = (int) b;
		System.out.println(c);
	}
} 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 X[] = new int[N];
		int a = 0;
		double b = 0;

		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			a += X[i];
		}
		double aa=a;
		double NN=N;
		sc.close();
		double A = Math.round(aa / NN);

		for (int i = 0; i < N; i++) {
			b += Math.pow((X[i] - A), 2);
		}
		int c = (int) b;
		System.out.println(c);
	}
}
