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

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        }
        System.out.println(ans);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        }
        System.out.println(ans);
    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[] X = new int[N]; X new int[N] N for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            X[i] = scan.nextInt();
        } {
            X[i] = scan.nextInt();
        } X[i] = scan.nextInt() X[i] X i scan.nextInt() scan.nextInt scan int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        } int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        } {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        } int cost = 0; cost 0 for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            } int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
                cost += (X[j]-i) * (X[j]-i);
            } {
                cost += (X[j]-i) * (X[j]-i);
            } cost += (X[j]-i) * (X[j]-i) cost (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, cost) ans Math.min(ans, cost) Math.min Math ans cost System.out.println(ans) System.out.println System.out System System.out ans public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        }
        System.out.println(ans);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= 100; i++) {
            int cost = 0;
            for (int j = 0; j < N; j++) {
                cost += (X[j]-i) * (X[j]-i);
            }
            ans = Math.min(ans, cost);
        }
        System.out.println(ans);
    }
}
