import io.StdIn._

object Main extends App {

  val N = readInt
  val X = readLine.split(" ").map(_.toInt)

  val ans = Range(X.min, X.max).map(
    i => X.map(x => (x-i) * (x-i)).sum
  ).min

  println(ans)
}
