import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int people = sc.nextInt();
		long anser = 0;
		long max =  1000000000000000000l;
		int[] hp = new int[people];
		for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		}
		//座標場所で一番最小のところ。
			for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			}
		System.out.println(max);

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int people = sc.nextInt();
		long anser = 0;
		long max =  1000000000000000000l;
		int[] hp = new int[people];
		for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		}
		//座標場所で一番最小のところ。
			for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			}
		System.out.println(max);

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int people = sc.nextInt();
		long anser = 0;
		long max =  1000000000000000000l;
		int[] hp = new int[people];
		for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		}
		//座標場所で一番最小のところ。
			for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			}
		System.out.println(max);

	} main {
		Scanner sc = new Scanner(System.in);

		int people = sc.nextInt();
		long anser = 0;
		long max =  1000000000000000000l;
		int[] hp = new int[people];
		for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		}
		//座標場所で一番最小のところ。
			for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			}
		System.out.println(max);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int people = sc.nextInt(); people sc.nextInt() sc.nextInt sc long anser = 0; anser 0 long max =  1000000000000000000l; max 1000000000000000000l int[] hp = new int[people]; hp new int[people] people for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		} int num = 0 ; int num = 0 ; num 0 num <people num people num++ num++ num {
			hp[num] = sc.nextInt();
		} {
			hp[num] = sc.nextInt();
		} hp[num] = sc.nextInt() hp[num] hp num sc.nextInt() sc.nextInt sc for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			} int num = 0; int num = 0; num 0 num < 100 num 100 num++ num++ num {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			} {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			} anser = 0 anser 0 for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				} int i = 0 ; int i = 0 ; i 0 i < people i people i++ i++ i {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				} {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				} anser +=(hp[i]-num) * (hp[i]-num) anser (hp[i]-num) * (hp[i]-num) (hp[i]-num) hp[i] hp i num (hp[i]-num) hp[i] hp i num if(max > anser) {
					max = anser;
				} max > anser max anser {
					max = anser;
				} max = anser max anser System.out.println(max) System.out.println System.out System System.out max String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int people = sc.nextInt();
		long anser = 0;
		long max =  1000000000000000000l;
		int[] hp = new int[people];
		for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		}
		//座標場所で一番最小のところ。
			for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			}
		System.out.println(max);

	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int people = sc.nextInt();
		long anser = 0;
		long max =  1000000000000000000l;
		int[] hp = new int[people];
		for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		}
		//座標場所で一番最小のところ。
			for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			}
		System.out.println(max);

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int people = sc.nextInt();
		long anser = 0;
		long max =  1000000000000000000l;
		int[] hp = new int[people];
		for(int num = 0 ; num <people; num++) {
			hp[num] = sc.nextInt();
		}
		//座標場所で一番最小のところ。
			for(int num = 0; num < 100; num++) {
				//最小を探すために毎回初期化
				anser = 0;
				for(int i = 0 ; i < people; i++) {
					//(x-p)2乗　公式
					//住人の座標-開催場所の座標
					anser +=(hp[i]-num) * (hp[i]-num);
				}
				if(max > anser) {
					max = anser;
				}
			}
		System.out.println(max);

	}
}
