import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N= sc.nextInt();
		int a[]=new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int min = 100000000;
		for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		}
		System.out.println(min);
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N= sc.nextInt();
		int a[]=new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int min = 100000000;
		for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		}
		System.out.println(min);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N= sc.nextInt();
		int a[]=new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int min = 100000000;
		for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		}
		System.out.println(min);
	} main {
		Scanner sc = new Scanner(System.in);
		int N;
		N= sc.nextInt();
		int a[]=new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int min = 100000000;
		for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		}
		System.out.println(min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N; N N= sc.nextInt() N sc.nextInt() sc.nextInt sc int a[]=new int[N]; a new int[N] N for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int min = 100000000; min 100000000 for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		} int i=1; int i=1; i 1 i<=100 i 100 i++ i++ i {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		} {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		} int sum=0; sum 0 for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			} int j=0; int j=0; j 0 j<N j N j++ j++ j {
				sum += (a[j]-i)*(a[j]-i);
			} {
				sum += (a[j]-i)*(a[j]-i);
			} sum += (a[j]-i)*(a[j]-i) sum (a[j]-i)*(a[j]-i) (a[j]-i) a[j] a j i (a[j]-i) a[j] a j i if (sum<min) {
				min =sum;
			} sum<min sum min {
				min =sum;
			} min =sum min sum System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N= sc.nextInt();
		int a[]=new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int min = 100000000;
		for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		}
		System.out.println(min);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N= sc.nextInt();
		int a[]=new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int min = 100000000;
		for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		}
		System.out.println(min);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N= sc.nextInt();
		int a[]=new int[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int min = 100000000;
		for (int i=1;i<=100;i++) {
			int sum=0;
			for (int j=0;j<N;j++) {
				sum += (a[j]-i)*(a[j]-i);
			}
			if (sum<min) {
				min =sum;
			}
		}
		System.out.println(min);
	}

}