import java.util.PriorityQueue;
import java.util.Scanner;

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

		// 入力値の取得
		int N = sc.nextInt();
		int[] R = new int[N];
		for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		}
		
		// 消費する体力の総和の計算
		PriorityQueue<Integer> pq = new PriorityQueue<> ();
		for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		}
		
		// 結果の出力
		System.out.println(pq.poll());

		sc.close();
	}
} import java.util.PriorityQueue; PriorityQueue 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();
		int[] R = new int[N];
		for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		}
		
		// 消費する体力の総和の計算
		PriorityQueue<Integer> pq = new PriorityQueue<> ();
		for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		}
		
		// 結果の出力
		System.out.println(pq.poll());

		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		int N = sc.nextInt();
		int[] R = new int[N];
		for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		}
		
		// 消費する体力の総和の計算
		PriorityQueue<Integer> pq = new PriorityQueue<> ();
		for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		}
		
		// 結果の出力
		System.out.println(pq.poll());

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		int N = sc.nextInt();
		int[] R = new int[N];
		for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		}
		
		// 消費する体力の総和の計算
		PriorityQueue<Integer> pq = new PriorityQueue<> ();
		for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		}
		
		// 結果の出力
		System.out.println(pq.poll());

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] R = new int[N]; R new int[N] N for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			R[i] = sc.nextInt();
		} {
			R[i] = sc.nextInt();
		} R[i] = sc.nextInt() R[i] R i sc.nextInt() sc.nextInt sc PriorityQueue<Integer> pq = new PriorityQueue<> (); pq new PriorityQueue<> () for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(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 += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		} {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		} int sum = 0; sum 0 for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			} int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
				sum += Math.pow(R[j]-i, 2);
			} {
				sum += Math.pow(R[j]-i, 2);
			} sum += Math.pow(R[j]-i, 2) sum Math.pow(R[j]-i, 2) Math.pow Math R[j]-i R[j] R j i 2 pq.add(sum) pq.add pq sum System.out.println(pq.poll()) System.out.println System.out System System.out pq.poll() pq.poll pq sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		int N = sc.nextInt();
		int[] R = new int[N];
		for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		}
		
		// 消費する体力の総和の計算
		PriorityQueue<Integer> pq = new PriorityQueue<> ();
		for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		}
		
		// 結果の出力
		System.out.println(pq.poll());

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

		// 入力値の取得
		int N = sc.nextInt();
		int[] R = new int[N];
		for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		}
		
		// 消費する体力の総和の計算
		PriorityQueue<Integer> pq = new PriorityQueue<> ();
		for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		}
		
		// 結果の出力
		System.out.println(pq.poll());

		sc.close();
	}
} Main
import java.util.PriorityQueue;
import java.util.Scanner;

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

		// 入力値の取得
		int N = sc.nextInt();
		int[] R = new int[N];
		for (int i = 0; i < N; i++) {
			R[i] = sc.nextInt();
		}
		
		// 消費する体力の総和の計算
		PriorityQueue<Integer> pq = new PriorityQueue<> ();
		for (int i = 1; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += Math.pow(R[j]-i, 2);
			}
			pq.add(sum);
		}
		
		// 結果の出力
		System.out.println(pq.poll());

		sc.close();
	}
}
