import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}

		int ans = Integer.MAX_VALUE;
		Collections.sort(list);
		for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections 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 = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}

		int ans = Integer.MAX_VALUE;
		Collections.sort(list);
		for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}

		int ans = Integer.MAX_VALUE;
		Collections.sort(list);
		for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}

		int ans = Integer.MAX_VALUE;
		Collections.sort(list);
		for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			list.add(Integer.parseInt(sc.next()));
		} {
			list.add(Integer.parseInt(sc.next()));
		} list.add(Integer.parseInt(sc.next())) list.add list Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE Collections.sort(list) Collections.sort Collections list for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		} int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		} {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		} int sum = 0; sum 0 for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			} int j = 0; int j = 0; j 0 j < list.size() j list.size() list.size list j++ j++ j {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			} {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			} int tmp = Math.abs(list.get(j) - i); tmp Math.abs(list.get(j) - i) Math.abs Math list.get(j) - i list.get(j) list.get list j i sum += tmp * tmp sum tmp * tmp tmp tmp ans = Math.min(ans, sum) ans Math.min(ans, sum) Math.min Math ans sum System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}

		int ans = Integer.MAX_VALUE;
		Collections.sort(list);
		for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}

		int ans = Integer.MAX_VALUE;
		Collections.sort(list);
		for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}

		int ans = Integer.MAX_VALUE;
		Collections.sort(list);
		for(int i = 1; i <= 100; i++) {
			int sum = 0;
			for(int j = 0; j < list.size(); j++) {
				int tmp = Math.abs(list.get(j) - i);
				sum += tmp * tmp;
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
}