import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() while(sc.hasNext()) {
			list.add(sc.nextInt());
		} sc.hasNext() sc.hasNext sc {
			list.add(sc.nextInt());
		} list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int answer = 1000000000; answer 1000000000 int sum; sum for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		} int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		} {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		} sum = 0 sum 0 for(Integer j: list) {
				sum += (j - i)*(j - i);
			} Integer j list {
				sum += (j - i)*(j - i);
			} {
				sum += (j - i)*(j - i);
			} sum += (j - i)*(j - i) sum (j - i)*(j - i) (j - i) j i (j - i) j i if(sum < answer) {
				answer = sum;
			} sum < answer sum answer {
				answer = sum;
			} answer = sum answer sum System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	}
}