fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val X = readLine()!!.split(" ").map(String::toLong)
    val p = (X.sum() + (X.size / 2)) / X.size
    println(X.map { (it - p) * (it - p) }.sum())
}