
import java.util.Scanner;
//【156】
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n =sc.nextInt();
		int[] xs =new int[n+1];
		int max=0;
		int min =100;
		for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		}
		int minHp=0;
		for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		}
		for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		}
		System.out.println(minHp);
		
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} 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[] xs =new int[n+1];
		int max=0;
		int min =100;
		for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		}
		int minHp=0;
		for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		}
		for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		}
		System.out.println(minHp);
		
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n =sc.nextInt();
		int[] xs =new int[n+1];
		int max=0;
		int min =100;
		for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		}
		int minHp=0;
		for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		}
		for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		}
		System.out.println(minHp);
		
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	} main {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n =sc.nextInt();
		int[] xs =new int[n+1];
		int max=0;
		int min =100;
		for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		}
		int minHp=0;
		for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		}
		for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		}
		System.out.println(minHp);
		
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n =sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] xs =new int[n+1]; xs new int[n+1] n+1 n 1 int max=0; max 0 int min =100; min 100 for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		} {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		} int xs_i =sc.nextInt(); xs_i sc.nextInt() sc.nextInt sc xs[i] =xs_i xs[i] xs i xs_i max =Math.max(max, xs_i) max Math.max(max, xs_i) Math.max Math max xs_i min =Math.min(min, xs_i) min Math.min(min, xs_i) Math.min Math min xs_i int minHp=0; minHp 0 for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			minHp +=(xs[i])*(xs[i]);
		} {
			minHp +=(xs[i])*(xs[i]);
		} minHp +=(xs[i])*(xs[i]) minHp (xs[i])*(xs[i]) (xs[i]) xs i (xs[i]) xs i for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		} int i=min; int i=min; i min i<=max i max i++ i++ i {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		} {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		} int hp =0; hp 0 for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			} int j=0; int j=0; j 0 j<n j n j++ j++ j {
				hp +=(xs[j]-i)*(xs[j]-i);
			} {
				hp +=(xs[j]-i)*(xs[j]-i);
			} hp +=(xs[j]-i)*(xs[j]-i) hp (xs[j]-i)*(xs[j]-i) (xs[j]-i) xs[j] xs j i (xs[j]-i) xs[j] xs j i minHp =Math.min(minHp, hp) minHp Math.min(minHp, hp) Math.min Math minHp hp System.out.println(minHp) System.out.println System.out System System.out minHp String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n =sc.nextInt();
		int[] xs =new int[n+1];
		int max=0;
		int min =100;
		for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		}
		int minHp=0;
		for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		}
		for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		}
		System.out.println(minHp);
		
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n =sc.nextInt();
		int[] xs =new int[n+1];
		int max=0;
		int min =100;
		for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		}
		int minHp=0;
		for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		}
		for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		}
		System.out.println(minHp);
		
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} Main

import java.util.Scanner;
//【156】
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n =sc.nextInt();
		int[] xs =new int[n+1];
		int max=0;
		int min =100;
		for (int i=0;i<n;i++) {
			int xs_i =sc.nextInt();
			xs[i] =xs_i;
			max =Math.max(max, xs_i);
			min =Math.min(min, xs_i);
		}
		int minHp=0;
		for (int i=0;i<n;i++) {
			minHp +=(xs[i])*(xs[i]);
		}
		for (int i=min;i<=max;i++) {
			int hp =0;
			for (int j=0;j<n;j++) {
				hp +=(xs[j]-i)*(xs[j]-i);
			}
			minHp =Math.min(minHp, hp);
		}
		System.out.println(minHp);
		
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
}