import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[][] list = new int[N][100];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		}
		int ans = listCheck(list);
		pw.print(ans);
		pw.close();
	}
	
	public static int listCheck(int[][] list) {
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		}
		return ans;
	}
} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[][] list = new int[N][100];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		}
		int ans = listCheck(list);
		pw.print(ans);
		pw.close();
	}
	
	public static int listCheck(int[][] list) {
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		}
		return ans;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[][] list = new int[N][100];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		}
		int ans = listCheck(list);
		pw.print(ans);
		pw.close();
	} main {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[][] list = new int[N][100];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		}
		int ans = listCheck(list);
		pw.print(ans);
		pw.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[][] list = new int[N][100]; list new int[N][100] N 100 for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		} {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			} int j = 1; int j = 1; j 1 j <= 100 j 100 j++ j++ j {
				list[i][j-1] = (j-a)*(j-a);
			} {
				list[i][j-1] = (j-a)*(j-a);
			} list[i][j-1] = (j-a)*(j-a) list[i][j-1] list[i] list i j-1 j 1 (j-a)*(j-a) (j-a) j a (j-a) j a int ans = listCheck(list); ans listCheck(list) listCheck list pw.print(ans) pw.print pw ans pw.close() pw.close pw String[] args args public static int listCheck(int[][] list) {
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		}
		return ans;
	} listCheck {
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		}
		return ans;
	} int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		} int i = 0; int i = 0; i 0 i < 100 i 100 i++ i++ i {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		} {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		} int check = 0; check 0 for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			} int j = 0; int j = 0; j 0 j < list.length j list.length list list.length j++ j++ j {
				check += list[j][i];
			} {
				check += list[j][i];
			} check += list[j][i] check list[j][i] list[j] list j i if(ans > check) {
				ans = check;
			} ans > check ans check {
				ans = check;
			} ans = check ans check return ans; ans int[][] list list public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[][] list = new int[N][100];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		}
		int ans = listCheck(list);
		pw.print(ans);
		pw.close();
	}
	
	public static int listCheck(int[][] list) {
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		}
		return ans;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[][] list = new int[N][100];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		}
		int ans = listCheck(list);
		pw.print(ans);
		pw.close();
	}
	
	public static int listCheck(int[][] list) {
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		}
		return ans;
	}
} Main
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[][] list = new int[N][100];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			for(int j = 1; j <= 100; j++) {
				list[i][j-1] = (j-a)*(j-a);
			}
		}
		int ans = listCheck(list);
		pw.print(ans);
		pw.close();
	}
	
	public static int listCheck(int[][] list) {
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 100; i++) {
			int check = 0;
			for(int j = 0; j < list.length; j++) {
				check += list[j][i];
			}
			if(ans > check) {
				ans = check;
			}
		}
		return ans;
	}
}