import java.util.Scanner;

public class Main {
	static void quick_sort(int[] d, int left, int right) {
		if (left >= right) {
			return;
		}
		int p = d[(left + right) / 2];
		int l = left, r = right;
		int tmp;
		while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r); // ピボットより左側をクイックソート
		quick_sort(d, l, right); // ピボットより右側をクイックソート
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int address[] = new int[N];
		for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		}
		if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	static void quick_sort(int[] d, int left, int right) {
		if (left >= right) {
			return;
		}
		int p = d[(left + right) / 2];
		int l = left, r = right;
		int tmp;
		while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r); // ピボットより左側をクイックソート
		quick_sort(d, l, right); // ピボットより右側をクイックソート
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int address[] = new int[N];
		for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		}
		if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		}
	}
} Main static void quick_sort(int[] d, int left, int right) {
		if (left >= right) {
			return;
		}
		int p = d[(left + right) / 2];
		int l = left, r = right;
		int tmp;
		while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r); // ピボットより左側をクイックソート
		quick_sort(d, l, right); // ピボットより右側をクイックソート
	} quick_sort {
		if (left >= right) {
			return;
		}
		int p = d[(left + right) / 2];
		int l = left, r = right;
		int tmp;
		while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r); // ピボットより左側をクイックソート
		quick_sort(d, l, right); // ピボットより右側をクイックソート
	} if (left >= right) {
			return;
		} left >= right left right {
			return;
		} return; int p = d[(left + right) / 2]; p d[(left + right) / 2] d (left + right) / 2 (left + right) left right 2 int l = left l left r = right; r right int tmp; tmp while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		} l <= r l r {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		} while (d[l] < p) {
				l++;
			} d[l] < p d[l] d l p {
				l++;
			} l++ l while (d[r] > p) {
				r--;
			} d[r] > p d[r] d r p {
				r--;
			} r-- r if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			} l <= r l r {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			} tmp = d[l] tmp d[l] d l d[l] = d[r] d[l] d l d[r] d r d[r] = tmp d[r] d r tmp l++ l r-- r quick_sort(d, left, r) quick_sort d left r quick_sort(d, l, right) quick_sort d l right int[] d d int left left int right right public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int address[] = new int[N];
		for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		}
		if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int address[] = new int[N];
		for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		}
		if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int address[] = new int[N]; address new int[N] N for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			address[i] = sc.nextInt();
		} {
			address[i] = sc.nextInt();
		} address[i] = sc.nextInt() address[i] address i sc.nextInt() sc.nextInt sc if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		} N == 1 N 1 {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		} quick_sort(address, 0, N - 1) quick_sort address 0 N - 1 N 1 int sum = 0; sum 0 int min = 0; min 0 for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
				min += address[i] * address[i];
			} {
				min += address[i] * address[i];
			} min += address[i] * address[i] min address[i] * address[i] address[i] address i address[i] address i for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			} int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			} {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			} for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				} int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
					sum += (address[j] - i) * (address[j] - i);
				} {
					sum += (address[j] - i) * (address[j] - i);
				} sum += (address[j] - i) * (address[j] - i) sum (address[j] - i) * (address[j] - i) (address[j] - i) address[j] address j i (address[j] - i) address[j] address j i if (sum < min) {
					min = sum;
				} sum < min sum min {
					min = sum;
				} min = sum min sum sum = 0 sum 0 System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
	static void quick_sort(int[] d, int left, int right) {
		if (left >= right) {
			return;
		}
		int p = d[(left + right) / 2];
		int l = left, r = right;
		int tmp;
		while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r); // ピボットより左側をクイックソート
		quick_sort(d, l, right); // ピボットより右側をクイックソート
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int address[] = new int[N];
		for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		}
		if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		}
	}
} public class Main {
	static void quick_sort(int[] d, int left, int right) {
		if (left >= right) {
			return;
		}
		int p = d[(left + right) / 2];
		int l = left, r = right;
		int tmp;
		while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r); // ピボットより左側をクイックソート
		quick_sort(d, l, right); // ピボットより右側をクイックソート
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int address[] = new int[N];
		for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		}
		if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	static void quick_sort(int[] d, int left, int right) {
		if (left >= right) {
			return;
		}
		int p = d[(left + right) / 2];
		int l = left, r = right;
		int tmp;
		while (l <= r) {
			while (d[l] < p) {
				l++;
			}
			while (d[r] > p) {
				r--;
			}
			if (l <= r) {
				tmp = d[l];
				d[l] = d[r];
				d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r); // ピボットより左側をクイックソート
		quick_sort(d, l, right); // ピボットより右側をクイックソート
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int address[] = new int[N];
		for (int i = 0; i < N; i++) {
			address[i] = sc.nextInt();
		}
		if (N == 1) {
			System.out.println(0);
		} else {

			quick_sort(address, 0, N - 1);
			int sum = 0;
			int min = 0;
			for (int i = 0; i < N; i++) {
				min += address[i] * address[i];
			}

			for (int i = 1; i <= 100; i++) {
				for (int j = 0; j < N; j++) {
					sum += (address[j] - i) * (address[j] - i);
				}
				if (sum < min) {
					min = sum;
				}
				sum = 0;
			}

			System.out.println(min);
		}
	}
}
