#include<bits/stdc++.h>

using namespace std;

const int INF = 0x3f3f3f3f;
int arr[105];

int main()
{
    int n, now, p, ans;
    while(cin >> n) {
        ans = INF;
        for(int i = 0; i < n; i++)
            cin >> arr[i];
        for(int i = 0; i < 100; i++) {
            now = 0;
            for(int j = 0; j < n; j++) {
                now += (i-arr[j])*(i-arr[j]);
            }
            ans = min(ans, now);
        }
        cout << ans << endl;
    }
}
