import io.StdIn._

object Main extends App {

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

  val avg = math.round(X.sum.toDouble / X.length)
  val ans = X.map(x => (x-avg)*(x-avg)).sum

  println(ans)
}
