function main(input) {
    var N = input[0].split(" ")[0]-0;
    var list = input[1].split(" ").map(v=>v-0);
    var ans = Number.MAX_SAFE_INTEGER;
    for(var p=0;p<=100;p++){
        var sum = 0;
        for(var i=0;i<N;i++){
            sum += (list[i]-p)*(list[i]-p);
        }
        ans = Math.min(ans,sum);
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
