object Main {
  def main(args:Array[String]) {
    val N = readLine().toInt
    var X = readLine().split(' ').map(_.toInt)

    var ans = X.map(a => a * a).sum
    for(P <- 0 to 100) {
      var sum = 0
      for(i <- 0 until X.size) {
        sum += (X(i) - P) * (X(i) - P)
      }
      if(sum < ans) ans = sum
    }
    println(ans)
  }
}
