import java.util.*;
import java.io.*;
 
public class Main{
    static PrintWriter out = new PrintWriter(System.out);
 
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] X = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        }
        average = Math.round(average/N);
        int sum = 0;
        for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        }

        System.out.println(sum);
       
    }
}  import java.util.*; util.* java import java.io.*; io.* java public class Main{
    static PrintWriter out = new PrintWriter(System.out);
 
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] X = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        }
        average = Math.round(average/N);
        int sum = 0;
        for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        }

        System.out.println(sum);
       
    }
} Main static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] X = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        }
        average = Math.round(average/N);
        int sum = 0;
        for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        }

        System.out.println(sum);
       
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] X = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        }
        average = Math.round(average/N);
        int sum = 0;
        for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        }

        System.out.println(sum);
       
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] X = new int[N]; X new int[N] N double average = 0; average 0 for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        } {
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        } X[i] = Integer.parseInt(sc.next()) X[i] X i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc average = average + X[i] average average + X[i] average X[i] X i average = Math.round(average/N) average Math.round(average/N) Math.round Math average/N average N int sum = 0; sum 0 for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        } {
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        } sum = sum + (X[i]-(int)average)*(X[i]-(int)average) sum sum + (X[i]-(int)average)*(X[i]-(int)average) sum (X[i]-(int)average)*(X[i]-(int)average) (X[i]-(int)average) X[i] X i (int)average (X[i]-(int)average) X[i] X i (int)average System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main{
    static PrintWriter out = new PrintWriter(System.out);
 
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] X = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        }
        average = Math.round(average/N);
        int sum = 0;
        for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        }

        System.out.println(sum);
       
    }
} public class Main{
    static PrintWriter out = new PrintWriter(System.out);
 
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] X = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        }
        average = Math.round(average/N);
        int sum = 0;
        for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        }

        System.out.println(sum);
       
    }
} Main
import java.util.*;
import java.io.*;
 
public class Main{
    static PrintWriter out = new PrintWriter(System.out);
 
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] X = new int[N];
        double average = 0;
        for(int i = 0; i < N; i++){
            X[i] = Integer.parseInt(sc.next());
            average = average + X[i];
        }
        average = Math.round(average/N);
        int sum = 0;
        for(int i = 0; i < N; i++){
            sum = sum + (X[i]-(int)average)*(X[i]-(int)average);
        }

        System.out.println(sum);
       
    }
} 