import java.util.*;
import java.io.*;
public class Main{

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		int min = Integer.MAX_VALUE;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		}
 		for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	

 import java.util.*; util.* java import java.io.*; io.* java public class Main{

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		int min = Integer.MAX_VALUE;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		}
 		for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
} Main public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		int min = Integer.MAX_VALUE;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		}
 		for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	} main {
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		int min = Integer.MAX_VALUE;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		}
 		for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	} int num = 998244353; num 998244353 BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); bf new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n = Integer.parseInt(bf.readLine()); n Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf ArrayList<Integer> array = new ArrayList<Integer>(); array new ArrayList<Integer>() int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE StringTokenizer st = new StringTokenizer(bf.readLine()); st new StringTokenizer(bf.readLine()) for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
 			array.add(Integer.parseInt(st.nextToken()));
 		} {
 			array.add(Integer.parseInt(st.nextToken()));
 		} array.add(Integer.parseInt(st.nextToken())) array.add array Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		} int i = 1; int i = 1; i 1 i<=100 i 100 i++ i++ i {
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		} {
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		} int sum = 0; sum 0 for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			} int j= 0; int j= 0; j 0 j<array.size() j array.size() array.size array j++ j++ j {
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			} {
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			} sum+= (array.get(j)-i)*(array.get(j)-i) sum (array.get(j)-i)*(array.get(j)-i) (array.get(j)-i) array.get(j) array.get array j i (array.get(j)-i) array.get(j) array.get array j i min = Math.min(sum,  min) min Math.min(sum,  min) Math.min Math sum min out.println(min) out.println out min out.close() out.close out String[] args args public class Main{

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		int min = Integer.MAX_VALUE;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		}
 		for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
} public class Main{

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		int min = Integer.MAX_VALUE;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		}
 		for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
} Main
import java.util.*;
import java.io.*;
public class Main{

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		int min = Integer.MAX_VALUE;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array.add(Integer.parseInt(st.nextToken()));
 		}
 		for(int i = 1;i<=100;i++){
 			int sum = 0;
 			for(int j= 0;j<array.size();j++){
 				sum+= (array.get(j)-i)*(array.get(j)-i);
 			}
 			min = Math.min(sum,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	


