import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int buf = 0;
		int buff = 0;
		int buf2 = 0;
		int ans = 1000000;
		int X,i;
		for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		}
		for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		}
		System.out.println(ans);
	}	
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int buf = 0;
		int buff = 0;
		int buf2 = 0;
		int ans = 1000000;
		int X,i;
		for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		}
		for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		}
		System.out.println(ans);
	}	
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int buf = 0;
		int buff = 0;
		int buf2 = 0;
		int ans = 1000000;
		int X,i;
		for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		}
		for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int buf = 0;
		int buff = 0;
		int buf2 = 0;
		int ans = 1000000;
		int X,i;
		for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		}
		for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int buf = 0; buf 0 int buff = 0; buff 0 int buf2 = 0; buf2 0 int ans = 1000000; ans 1000000 int X X i; i for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		} i = 0; i = 0 i 0 i < N i N i++ i++ i {
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		} {
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		} X = sc.nextInt() X sc.nextInt() sc.nextInt sc buf += X buf X buff += X * X buff X * X X X for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		} i = 1; i = 1 i 1 i < 101 i 101 i++ i++ i {
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		} {
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		} buf2 = buff + i * ((N * i) - (2 * buf)) buf2 buff + i * ((N * i) - (2 * buf)) buff i * ((N * i) - (2 * buf)) i ((N * i) - (2 * buf)) (N * i) N i (2 * buf) 2 buf if(ans > buf2){
				ans = buf2;
			} ans > buf2 ans buf2 {
				ans = buf2;
			} ans = buf2 ans buf2 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 = sc.nextInt();
		int buf = 0;
		int buff = 0;
		int buf2 = 0;
		int ans = 1000000;
		int X,i;
		for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		}
		for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		}
		System.out.println(ans);
	}	
} public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int buf = 0;
		int buff = 0;
		int buf2 = 0;
		int ans = 1000000;
		int X,i;
		for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		}
		for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		}
		System.out.println(ans);
	}	
} Main
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int buf = 0;
		int buff = 0;
		int buf2 = 0;
		int ans = 1000000;
		int X,i;
		for(i = 0;i < N;i++){
			X = sc.nextInt();
			buf += X;
			buff += X * X;
		}
		for(i = 1;i < 101;i++){
			buf2 = buff + i * ((N * i) - (2 * buf));
			if(ans > buf2){
				ans = buf2;
			}
		}
		System.out.println(ans);
	}	
}