fun main (args : Array<String>) {
    val n = readLine()!!.toInt()
    val list = readLine()!!.split(" ")

    var xList : MutableList<Int> = mutableListOf()

    var calc1 : Int = 0
    var calc2 : Int = 0
    var minNum : Int = 0

    for (i in list) {
        xList.add(i.toInt())
    }

    var test : Int = xList.max()!!
    
    for (i in 1..test) {
        calc2 = 0
        for (j in 0..xList.size - 1) {
            calc1 = xList[j] - i
            calc2 += calc1 * calc1
        }

        if (i == 1) {
            minNum = calc2
            continue
        } 

        if (minNum > calc2) {
            minNum = calc2
        }

    }

    println("${minNum}")

}