import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];

        int i = 0;
		while(i < N) {
			x[i] = sc.nextInt();
			i++;
		}

		int min = 101;
		int max = -1;
		for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		}

		int minPower=0;

		for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		}

		System.out.println(minPower);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];

        int i = 0;
		while(i < N) {
			x[i] = sc.nextInt();
			i++;
		}

		int min = 101;
		int max = -1;
		for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		}

		int minPower=0;

		for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		}

		System.out.println(minPower);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];

        int i = 0;
		while(i < N) {
			x[i] = sc.nextInt();
			i++;
		}

		int min = 101;
		int max = -1;
		for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		}

		int minPower=0;

		for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		}

		System.out.println(minPower);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];

        int i = 0;
		while(i < N) {
			x[i] = sc.nextInt();
			i++;
		}

		int min = 101;
		int max = -1;
		for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		}

		int minPower=0;

		for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		}

		System.out.println(minPower);
	} 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 i = 0; i 0 while(i < N) {
			x[i] = sc.nextInt();
			i++;
		} i < N i N {
			x[i] = sc.nextInt();
			i++;
		} x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc i++ i int min = 101; min 101 int max = -1; max -1 1 for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		} int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		} {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		} if(x[j] <min) {
				min = x[j];
			} x[j] <min x[j] x j min {
				min = x[j];
			} min = x[j] min x[j] x j if(x[j] >max) {
				max = x[j];
			} x[j] >max x[j] x j max {
				max = x[j];
			} max = x[j] max x[j] x j int minPower=0; minPower 0 for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		} i = min; i = min i min i <= max i max i++ i++ i {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		} {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		} int power = 0; power 0 for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			} int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
				power += (i-x[j])*(i-x[j]);
			} {
				power += (i-x[j])*(i-x[j]);
			} power += (i-x[j])*(i-x[j]) power (i-x[j])*(i-x[j]) (i-x[j]) i x[j] x j (i-x[j]) i x[j] x j if(i == min || (i != min && minPower > power)) {
				minPower = power;
			} i == min || (i != min && minPower > power) i == min i min (i != min && minPower > power) i != min i min minPower > power minPower power {
				minPower = power;
			} minPower = power minPower power System.out.println(minPower) System.out.println System.out System System.out minPower String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];

        int i = 0;
		while(i < N) {
			x[i] = sc.nextInt();
			i++;
		}

		int min = 101;
		int max = -1;
		for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		}

		int minPower=0;

		for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		}

		System.out.println(minPower);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];

        int i = 0;
		while(i < N) {
			x[i] = sc.nextInt();
			i++;
		}

		int min = 101;
		int max = -1;
		for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		}

		int minPower=0;

		for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		}

		System.out.println(minPower);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];

        int i = 0;
		while(i < N) {
			x[i] = sc.nextInt();
			i++;
		}

		int min = 101;
		int max = -1;
		for(int j = 0; j < N ; j++) {
			if(x[j] <min) {
				min = x[j];
			}
			if(x[j] >max) {
				max = x[j];
			}
		}

		int minPower=0;

		for(i = min; i <= max; i++) {
			int power = 0;
			for(int j = 0; j < N ; j++) {
				power += (i-x[j])*(i-x[j]);
			}
			if(i == min || (i != min && minPower > power)) {
				minPower = power;
			}
		}

		System.out.println(minPower);
	}

}
