
import java.util.Arrays;
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());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	}

} import java.util.Arrays; Arrays 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());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	} 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 int []x = new int [n]; x new int [n] n for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		} int i= 0 ; int i= 0 ; i 0 i < n i n i++ i++ i {
			x[i] = Integer.parseInt(sc.next());
		} {
			x[i] = Integer.parseInt(sc.next());
		} x[i] = Integer.parseInt(sc.next()) x[i] x i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Arrays.sort(x) Arrays.sort Arrays x int min = n* x[n-1] * x[n-1]; min n* x[n-1] * x[n-1] n* x[n-1] * x[n-1] n x[n-1] x n-1 n 1 x[n-1] x n-1 n 1 for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		} int i = x[0] ; int i = x[0] ; i x[0] x 0 i <= x[n-1] i x[n-1] x n-1 n 1 i++ i++ i {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		} {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		} int temp = 0; temp 0 for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			} int j = 0 ; int j = 0 ; j 0 j < n j n j++ j++ j {
				temp += Math.pow(i-x[j], 2);
			} {
				temp += Math.pow(i-x[j], 2);
			} temp += Math.pow(i-x[j], 2) temp Math.pow(i-x[j], 2) Math.pow Math i-x[j] i x[j] x j 2 min = Math.min(temp, min) min Math.min(temp, min) Math.min Math temp min 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 = Integer.parseInt(sc.next());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	}

} Main

import java.util.Arrays;
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());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	}

}
