function main(input) {
    input = input.split("\n");
    x = input[1].split(" ").map(x => Number(x));
    var total = 0;
    for (var i = 0; i < x.length; i++) {
        total += x[i];
    }
    var p = Math.round(total/x.length);
    var ans = 0;
    for (var i = 0; i < x.length; i++) {
        ans += Math.abs(Math.pow((x[i] - p), 2));
    }

    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));