object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val nums = Seq.fill(n)(sc.nextInt())
  val xSqSum = nums.map(x => x * x).sum
  val xSum = nums.sum
  println {
    (for {
      i <- 1 to 100
    } yield {
      val `-2y` = -2 * i
      xSqSum + `-2y` * xSum + i * i * n
    }).min
  }
}