import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X[] = new int[N];
        int min = 101;
        int max = 0;
        for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        }

        int ans = Integer.MAX_VALUE;
        for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        }

        os.println(ans);
    }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X[] = new int[N];
        int min = 101;
        int max = 0;
        for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        }

        int ans = Integer.MAX_VALUE;
        for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        }

        os.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    } main {
        solve(System.in, System.out);
    } solve(System.in, System.out) solve System.in System System.in System.out System System.out String[] args args static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X[] = new int[N];
        int min = 101;
        int max = 0;
        for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        }

        int ans = Integer.MAX_VALUE;
        for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        }

        os.println(ans);
    } solve {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X[] = new int[N];
        int min = 101;
        int max = 0;
        for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        }

        int ans = Integer.MAX_VALUE;
        for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        }

        os.println(ans);
    } Scanner scan = new Scanner(is); scan new Scanner(is) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int X[] = new int[N]; X new int[N] N int min = 101; min 101 int max = 0; max 0 for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        } {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        } X[i] = scan.nextInt() X[i] X i scan.nextInt() scan.nextInt scan min = Math.min(min, X[i]) min Math.min(min, X[i]) Math.min Math min X[i] X i max = Math.max(max, X[i]) max Math.max(max, X[i]) Math.max Math max X[i] X i int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        } int i = min ; int i = min ; i min i <= max i max i++ i++ i {
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        } {
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        } int sum = 0; sum 0 for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            } int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
                sum += (X[j]-i)*(X[j]-i);
            } {
                sum += (X[j]-i)*(X[j]-i);
            } sum += (X[j]-i)*(X[j]-i) sum (X[j]-i)*(X[j]-i) (X[j]-i) X[j] X j i (X[j]-i) X[j] X j i ans = Math.min(ans, sum) ans Math.min(ans, sum) Math.min Math ans sum os.println(ans) os.println os ans InputStream is is PrintStream os os public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X[] = new int[N];
        int min = 101;
        int max = 0;
        for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        }

        int ans = Integer.MAX_VALUE;
        for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        }

        os.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X[] = new int[N];
        int min = 101;
        int max = 0;
        for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        }

        int ans = Integer.MAX_VALUE;
        for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        }

        os.println(ans);
    }
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X[] = new int[N];
        int min = 101;
        int max = 0;
        for(int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
            min = Math.min(min, X[i]);
            max = Math.max(max, X[i]);
        }

        int ans = Integer.MAX_VALUE;
        for(int i = min ; i <= max; i++){
            int sum = 0;
            for(int j = 0; j < N; j++){
                sum += (X[j]-i)*(X[j]-i);
            }
            ans = Math.min(ans, sum);
        }

        os.println(ans);
    }
}