import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		int X[] = new int[N];
		
		int sum = 0;
		for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		}

		long C = Math.round((double)sum/N);
		int ans = 0;
		for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		}
		
		System.out.println(ans);
		keyboard.close();
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		int X[] = new int[N];
		
		int sum = 0;
		for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		}

		long C = Math.round((double)sum/N);
		int ans = 0;
		for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		}
		
		System.out.println(ans);
		keyboard.close();
	}
} Main public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		int X[] = new int[N];
		
		int sum = 0;
		for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		}

		long C = Math.round((double)sum/N);
		int ans = 0;
		for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		}
		
		System.out.println(ans);
		keyboard.close();
	} main {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		int X[] = new int[N];
		
		int sum = 0;
		for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		}

		long C = Math.round((double)sum/N);
		int ans = 0;
		for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		}
		
		System.out.println(ans);
		keyboard.close();
	} Scanner keyboard = new Scanner(System.in); keyboard new Scanner(System.in) int N = keyboard.nextInt(); N keyboard.nextInt() keyboard.nextInt keyboard int X[] = new int[N]; X new int[N] N int sum = 0; sum 0 for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		} int x=0; int x=0; x 0 x<N x N x++ x++ x {
			X[x] = keyboard.nextInt();
			sum += X[x];
		} {
			X[x] = keyboard.nextInt();
			sum += X[x];
		} X[x] = keyboard.nextInt() X[x] X x keyboard.nextInt() keyboard.nextInt keyboard sum += X[x] sum X[x] X x long C = Math.round((double)sum/N); C Math.round((double)sum/N) Math.round Math (double)sum/N (double)sum N int ans = 0; ans 0 for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		} int c=0; int c=0; c 0 c<N c N c++ c++ c {
			ans += Math.pow(X[c]-C, 2);
		} {
			ans += Math.pow(X[c]-C, 2);
		} ans += Math.pow(X[c]-C, 2) ans Math.pow(X[c]-C, 2) Math.pow Math X[c]-C X[c] X c C 2 System.out.println(ans) System.out.println System.out System System.out ans keyboard.close() keyboard.close keyboard String[] args args public class Main {

	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		int X[] = new int[N];
		
		int sum = 0;
		for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		}

		long C = Math.round((double)sum/N);
		int ans = 0;
		for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		}
		
		System.out.println(ans);
		keyboard.close();
	}
} public class Main {

	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		int X[] = new int[N];
		
		int sum = 0;
		for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		}

		long C = Math.round((double)sum/N);
		int ans = 0;
		for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		}
		
		System.out.println(ans);
		keyboard.close();
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		int X[] = new int[N];
		
		int sum = 0;
		for(int x=0; x<N; x++) {
			X[x] = keyboard.nextInt();
			sum += X[x];
		}

		long C = Math.round((double)sum/N);
		int ans = 0;
		for(int c=0; c<N; c++) {
			ans += Math.pow(X[c]-C, 2);
		}
		
		System.out.println(ans);
		keyboard.close();
	}
}
