    import java.util.*;
	import java.lang.Math;
    public class Main
	{
		public static void main(String args[])
		{
			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			}
			int max=Integer.MAX_VALUE;
			int temp=0;
			for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			}
			System.out.println(max);
		}
    } import java.util.*; util.* java import java.lang.Math; Math java.lang public class Main
	{
		public static void main(String args[])
		{
			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			}
			int max=Integer.MAX_VALUE;
			int temp=0;
			for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			}
			System.out.println(max);
		}
    } Main public static void main(String args[])
		{
			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			}
			int max=Integer.MAX_VALUE;
			int temp=0;
			for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			}
			System.out.println(max);
		} main {
			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			}
			int max=Integer.MAX_VALUE;
			int temp=0;
			for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			}
			System.out.println(max);
		} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] a = new int[n]; a new int[n] n for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				a[i]=scan.nextInt();
			} {
				a[i]=scan.nextInt();
			} a[i]=scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan int max=Integer.MAX_VALUE; max Integer.MAX_VALUE Integer Integer.MAX_VALUE int temp=0; temp 0 for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			} int i=1; int i=1; i 1 i<=100 i 100 i++ i++ i {
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			} {
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			} temp=0 temp 0 for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				} int j=0; int j=0; j 0 j<n j n j++ j++ j {
					temp+=(i-a[j])*(i-a[j]);
				} {
					temp+=(i-a[j])*(i-a[j]);
				} temp+=(i-a[j])*(i-a[j]) temp (i-a[j])*(i-a[j]) (i-a[j]) i a[j] a j (i-a[j]) i a[j] a j max=Math.min(max,temp) max Math.min(max,temp) Math.min Math max temp System.out.println(max) System.out.println System.out System System.out max String args[] args public class Main
	{
		public static void main(String args[])
		{
			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			}
			int max=Integer.MAX_VALUE;
			int temp=0;
			for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			}
			System.out.println(max);
		}
    } public class Main
	{
		public static void main(String args[])
		{
			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			}
			int max=Integer.MAX_VALUE;
			int temp=0;
			for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			}
			System.out.println(max);
		}
    } Main
    import java.util.*;
	import java.lang.Math;
    public class Main
	{
		public static void main(String args[])
		{
			Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextInt();
			}
			int max=Integer.MAX_VALUE;
			int temp=0;
			for(int i=1; i<=100; i++)
			{
				temp=0;
				for(int j=0; j<n; j++)
				{
					temp+=(i-a[j])*(i-a[j]);
				}
            max=Math.min(max,temp);
			}
			System.out.println(max);
		}
    }