#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
vector<pair<int, int> > arr;
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    long long one = sqrt(x), two = one + 1;
    one *= one, two *= two;
    long long mn = min(x - one, two - x);
    arr.push_back(pair<int, int>(mn, x));
  }
  sort(arr.begin(), arr.end());
  long long ans = 0;
  for (int i = 0; i < n / 2; i++) {
    ans += arr[i].first;
  }
  if (ans == 0) {
    for (int i = n / 2; i < n; i++) {
      if (arr[i].first == 0) {
        if (arr[i].second == 0)
          ans += 2;
        else
          ans++;
      }
    }
  }
  cout << ans << endl;
}
