import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int n;
    int[] x;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int n;
    int[] x;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    }
} Main int n; n int[] x; x public static void main(String[] args) {
        Main main = new Main();
        main.run();
    } main {
        Main main = new Main();
        main.run();
    } Main main = new Main(); main new Main() main.run() main.run main String[] args args public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    } run {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc x = new int[n] x new int[n] n for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            x[i] = sc.nextInt();
        } {
            x[i] = sc.nextInt();
        } x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc sc.close() sc.close sc solve() solve private void solve() {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    } solve {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    } int cur_cost = 0; cur_cost 0 int cost = Integer.MAX_VALUE / 2; cost Integer.MAX_VALUE / 2 Integer.MAX_VALUE Integer Integer.MAX_VALUE 2 for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        } int i = 0; int i = 0; i 0 i <= 100 i 100 i++ i++ i {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        } {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        } for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            } int j = 0; int j = 0; j 0 j < x.length j x.length x x.length j++ j++ j {
                cur_cost += (x[j] - i)*(x[j] - i);
            } {
                cur_cost += (x[j] - i)*(x[j] - i);
            } cur_cost += (x[j] - i)*(x[j] - i) cur_cost (x[j] - i)*(x[j] - i) (x[j] - i) x[j] x j i (x[j] - i) x[j] x j i cost = Math.min(cost, cur_cost) cost Math.min(cost, cur_cost) Math.min Math cost cur_cost cur_cost = 0 cur_cost 0 System.out.println(cost) System.out.println System.out System System.out cost public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int n;
    int[] x;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int n;
    int[] x;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int n;
    int[] x;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        int cur_cost = 0;
        int cost = Integer.MAX_VALUE / 2;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < x.length; j++) {
                cur_cost += (x[j] - i)*(x[j] - i);
            }
            cost = Math.min(cost, cur_cost);
            cur_cost = 0;
        }
        System.out.println(cost);
    }
}