import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

    int min = 1_000_000;
    for (int i = 1; i <= 100; i++) {
      int cost = 0;
      for (int j = 0; j < N; j++) cost += (X[j] - i) * (X[j] - i);
      min = Math.min(min, cost);
    }
    System.out.println(min);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

    int min = 1_000_000;
    for (int i = 1; i <= 100; i++) {
      int cost = 0;
      for (int j = 0; j < N; j++) cost += (X[j] - i) * (X[j] - i);
      min = Math.min(min, cost);
    }
    System.out.println(min);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

    int min = 1_000_000;
    for (int i = 1; i <= 100; i++) {
      int cost = 0;
      for (int j = 0; j < N; j++) cost += (X[j] - i) * (X[j] - i);
      min = Math.min(min, cost);
    }
    System.out.println(min);
  } main {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

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

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

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

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

    int min = 1_000_000;
    for (int i = 1; i <= 100; i++) {
      int cost = 0;
      for (int j = 0; j < N; j++) cost += (X[j] - i) * (X[j] - i);
      min = Math.min(min, cost);
    }
    System.out.println(min);
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

    int min = 1_000_000;
    for (int i = 1; i <= 100; i++) {
      int cost = 0;
      for (int j = 0; j < N; j++) cost += (X[j] - i) * (X[j] - i);
      min = Math.min(min, cost);
    }
    System.out.println(min);
  }
}
