import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] X = new int[n];
		int sum = Integer.MAX_VALUE;

		for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		}

			for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			}

		System.out.println(sum);

		scan.close();

	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] X = new int[n];
		int sum = Integer.MAX_VALUE;

		for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		}

			for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			}

		System.out.println(sum);

		scan.close();

	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] X = new int[n];
		int sum = Integer.MAX_VALUE;

		for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		}

			for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			}

		System.out.println(sum);

		scan.close();

	} main {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] X = new int[n];
		int sum = Integer.MAX_VALUE;

		for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		}

			for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			}

		System.out.println(sum);

		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] X = new int[n]; X new int[n] n int sum = Integer.MAX_VALUE; sum Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {

			X[i] = scan.nextInt();
		} {

			X[i] = scan.nextInt();
		} X[i] = scan.nextInt() X[i] X i scan.nextInt() scan.nextInt scan for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			} int j=1; int j=1; j 1 j<=100 j 100 j++ j++ j {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			} {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			} int hp = 0; hp 0 for(int i:X) {
				hp += (i-j)*(i-j);
			} int i X {
				hp += (i-j)*(i-j);
			} {
				hp += (i-j)*(i-j);
			} hp += (i-j)*(i-j) hp (i-j)*(i-j) (i-j) i j (i-j) i j sum = Math.min(hp,sum) sum Math.min(hp,sum) Math.min Math hp sum System.out.println(sum) System.out.println System.out System System.out sum scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] X = new int[n];
		int sum = Integer.MAX_VALUE;

		for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		}

			for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			}

		System.out.println(sum);

		scan.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] X = new int[n];
		int sum = Integer.MAX_VALUE;

		for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		}

			for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			}

		System.out.println(sum);

		scan.close();

	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] X = new int[n];
		int sum = Integer.MAX_VALUE;

		for(int i=0;i<n;i++) {

			X[i] = scan.nextInt();
		}

			for(int j=1;j<=100;j++) {

				int hp = 0;
				for(int i:X) {
				hp += (i-j)*(i-j);
			}
				sum = Math.min(hp,sum);
			}

		System.out.println(sum);

		scan.close();

	}

}
