import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeSet;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt();
		int minStamina = (1 << 30);
		for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		}
		System.out.println(minStamina);
		scanner.close();
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util import java.util.TreeSet; TreeSet java.util public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt();
		int minStamina = (1 << 30);
		for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		}
		System.out.println(minStamina);
		scanner.close();
	}
} Main public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt();
		int minStamina = (1 << 30);
		for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		}
		System.out.println(minStamina);
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt();
		int minStamina = (1 << 30);
		for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		}
		System.out.println(minStamina);
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] a = new int[n]; a new int[n] n for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt(); int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i a[i] = scanner.nextInt(); a[i] = scanner.nextInt() a[i] a i scanner.nextInt() scanner.nextInt scanner int minStamina = (1 << 30); minStamina (1 << 30) 1 30 for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		} int p = 1, stamina ; int p = 1 p 1 stamina ; stamina p <= 100 p 100 p++ p++ p {
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		} {
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		} stamina = 0 stamina 0 for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p); int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i stamina += (a[i] - p) * (a[i] - p); stamina += (a[i] - p) * (a[i] - p) stamina (a[i] - p) * (a[i] - p) (a[i] - p) a[i] a i p (a[i] - p) a[i] a i p minStamina = Math.min(minStamina, stamina) minStamina Math.min(minStamina, stamina) Math.min Math minStamina stamina System.out.println(minStamina) System.out.println System.out System System.out minStamina scanner.close() scanner.close scanner String[] args args public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt();
		int minStamina = (1 << 30);
		for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		}
		System.out.println(minStamina);
		scanner.close();
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt();
		int minStamina = (1 << 30);
		for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		}
		System.out.println(minStamina);
		scanner.close();
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeSet;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++)
			a[i] = scanner.nextInt();
		int minStamina = (1 << 30);
		for(int p = 1, stamina ; p <= 100 ; p++)
		{
			stamina = 0;
			for(int i = 0 ; i < n ; i++)
				stamina += (a[i] - p) * (a[i] - p);
			minStamina = Math.min(minStamina, stamina);
		}
		System.out.println(minStamina);
		scanner.close();
	}
}