function main(input) {
    input = input.trim().split("\n");
    n = parseInt(input[0]);
    x = input[1].split(" ").map(p => Number(p));

    var total = 0;
    for (var i = 0; i < x.length; i++) {
        total += x[i];
    }

    var c = Math.round(total/n);
    var ans = 0;
    for (var i = 0; i < x.length; i++) {
        ans += Math.pow(Math.abs(x[i]-c), 2);
    }

    console.log(ans);
}

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