#include <bits/stdc++.h>
using namespace std;
long long ne(long long a) {
  long long k = pow(a, 0.5);
  if (k * k == a) {
    return 0;
  }
  return min(a - (k * k), (k + 1) * (k + 1) - a);
}
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > a(n, make_pair(0, 0));
  for (long long i = 0; i < n; i++) {
    cin >> a[i].second;
    a[i].first = ne(a[i].second);
  }
  sort(a.begin(), a.end());
  if (a[n / 2].first == 0) {
    long long c = 0;
    long long u = n / 2;
    long long count = 0;
    while (u < n && a[u].first == 0) {
      c++;
      u++;
    }
    u = c;
    for (long long i = 0; i < n; i++) {
      if (a[i].first == 0 && a[i].second != 0) {
        u--;
        count++;
      }
      if (u == 0) {
        break;
      }
    }
    while (u--) {
      count += 2;
    }
    cout << count << endl;
  } else {
    long long count = 0;
    for (long long i = 0; i < n / 2; i++) {
      count = count + a[i].first;
    }
    cout << count << endl;
  }
}
