import std.stdio, std.conv, std.string, std.algorithm, std.math, std.array, std.container;

void main() {
  int n = readln.chomp.to!int;
  int[] x = readln.chomp.split.to!(int[]);
  int minimum = int.max;
  for(int p=1; p<=100; p++) {
    int cost = 0;
    foreach(xi;x) {
      cost += (xi-p)*(xi-p);
    }
    minimum = min(cost, minimum);
  }
  writeln(minimum);
}

