import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {
    static Scanner sc;
    public static void main(final String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sc = new Scanner(System.in);
        int numberOfPeople;
		try {
			numberOfPeople = Integer.parseInt(br.readLine());
		
        Long numberOfCoordinates[] = new Long[numberOfPeople];
        
        String string[] = br.readLine().split(" ");
        for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        }

        long output = Long.MAX_VALUE;

        for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        }

        System.out.println(output);

    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }

    public static int findBaseK(int n, final int k) {
        if(n==0) return 1;

        int i = 0;
        while(n!=0){
            n = Math.floorDiv(n, k);
            i++;
        }


        return i;
    }

    public static int parseInt(){
        return Integer.parseInt(sc.next());
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util class Main {
    static Scanner sc;
    public static void main(final String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sc = new Scanner(System.in);
        int numberOfPeople;
		try {
			numberOfPeople = Integer.parseInt(br.readLine());
		
        Long numberOfCoordinates[] = new Long[numberOfPeople];
        
        String string[] = br.readLine().split(" ");
        for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        }

        long output = Long.MAX_VALUE;

        for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        }

        System.out.println(output);

    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }

    public static int findBaseK(int n, final int k) {
        if(n==0) return 1;

        int i = 0;
        while(n!=0){
            n = Math.floorDiv(n, k);
            i++;
        }


        return i;
    }

    public static int parseInt(){
        return Integer.parseInt(sc.next());
    }
} Main static Scanner sc; sc public static void main(final String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sc = new Scanner(System.in);
        int numberOfPeople;
		try {
			numberOfPeople = Integer.parseInt(br.readLine());
		
        Long numberOfCoordinates[] = new Long[numberOfPeople];
        
        String string[] = br.readLine().split(" ");
        for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        }

        long output = Long.MAX_VALUE;

        for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        }

        System.out.println(output);

    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    } main {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sc = new Scanner(System.in);
        int numberOfPeople;
		try {
			numberOfPeople = Integer.parseInt(br.readLine());
		
        Long numberOfCoordinates[] = new Long[numberOfPeople];
        
        String string[] = br.readLine().split(" ");
        for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        }

        long output = Long.MAX_VALUE;

        for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        }

        System.out.println(output);

    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) sc = new Scanner(System.in) sc new Scanner(System.in) int numberOfPeople; numberOfPeople try {
			numberOfPeople = Integer.parseInt(br.readLine());
		
        Long numberOfCoordinates[] = new Long[numberOfPeople];
        
        String string[] = br.readLine().split(" ");
        for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        }

        long output = Long.MAX_VALUE;

        for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        }

        System.out.println(output);

    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } NumberFormatException e {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } e.printStackTrace() e.printStackTrace e catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } IOException e {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } e.printStackTrace() e.printStackTrace e {
			numberOfPeople = Integer.parseInt(br.readLine());
		
        Long numberOfCoordinates[] = new Long[numberOfPeople];
        
        String string[] = br.readLine().split(" ");
        for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        }

        long output = Long.MAX_VALUE;

        for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        }

        System.out.println(output);

    } numberOfPeople = Integer.parseInt(br.readLine()) numberOfPeople Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br Long numberOfCoordinates[] = new Long[numberOfPeople]; numberOfCoordinates new Long[numberOfPeople] numberOfPeople String string[] = br.readLine().split(" "); string br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        } int i = 0; int i = 0; i 0 i < numberOfPeople i numberOfPeople i++ i++ i {
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        } {
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        } numberOfCoordinates[i] = Long.parseLong(string[i]) numberOfCoordinates[i] numberOfCoordinates i Long.parseLong(string[i]) Long.parseLong Long string[i] string i long output = Long.MAX_VALUE; output Long.MAX_VALUE Long Long.MAX_VALUE for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        } int i = 0; int i = 0; i 0 i <= 100 i 100 i++ i++ i {
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        } {
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        } long cost = 0; cost 0 for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            } int j = 0; int j = 0; j 0 j < numberOfPeople j numberOfPeople j++ j++ j {
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            } {
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            } cost += Math.pow(numberOfCoordinates[j]-i,2) cost Math.pow(numberOfCoordinates[j]-i,2) Math.pow Math numberOfCoordinates[j]-i numberOfCoordinates[j] numberOfCoordinates j i 2 output = Math.min(output,cost) output Math.min(output,cost) Math.min Math output cost System.out.println(output) System.out.println System.out System System.out output final String[] args args public static int findBaseK(int n, final int k) {
        if(n==0) return 1;

        int i = 0;
        while(n!=0){
            n = Math.floorDiv(n, k);
            i++;
        }


        return i;
    } findBaseK {
        if(n==0) return 1;

        int i = 0;
        while(n!=0){
            n = Math.floorDiv(n, k);
            i++;
        }


        return i;
    } if(n==0) return 1; n==0 n 0 return 1; 1 int i = 0; i 0 while(n!=0){
            n = Math.floorDiv(n, k);
            i++;
        } n!=0 n 0 {
            n = Math.floorDiv(n, k);
            i++;
        } n = Math.floorDiv(n, k) n Math.floorDiv(n, k) Math.floorDiv Math n k i++ i return i; i int n n final int k k public static int parseInt(){
        return Integer.parseInt(sc.next());
    } parseInt {
        return Integer.parseInt(sc.next());
    } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {
    static Scanner sc;
    public static void main(final String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sc = new Scanner(System.in);
        int numberOfPeople;
		try {
			numberOfPeople = Integer.parseInt(br.readLine());
		
        Long numberOfCoordinates[] = new Long[numberOfPeople];
        
        String string[] = br.readLine().split(" ");
        for (int i = 0; i < numberOfPeople; i++){
            numberOfCoordinates[i] = Long.parseLong(string[i]);
        }

        long output = Long.MAX_VALUE;

        for(int i = 0; i <= 100; i++){
            long cost = 0;
            for (int j = 0; j < numberOfPeople; j++){
                cost += Math.pow(numberOfCoordinates[j]-i,2);
            }
            output = Math.min(output,cost);
        }

        System.out.println(output);

    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }

    public static int findBaseK(int n, final int k) {
        if(n==0) return 1;

        int i = 0;
        while(n!=0){
            n = Math.floorDiv(n, k);
            i++;
        }


        return i;
    }

    public static int parseInt(){
        return Integer.parseInt(sc.next());
    }
}