#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
int num[maxn];
int T;
int tot1, tot2;
int need1[maxn];
int need2[maxn];
void read() {
  cin >> T;
  for (int i = 0; i < T; i++) {
    scanf("%d", &num[i]);
    int kase = sqrt(num[i]);
    if (kase * kase == num[i]) {
      if (num[i] == 0) {
        need1[tot1] = 2;
        tot1++;
      } else {
        need1[tot1] = 1;
        tot1++;
      }
    } else {
      need2[tot2] = min(num[i] - kase * kase, (kase + 1) * (kase + 1) - num[i]);
      tot2++;
    }
  }
  return;
}
int main() {
  read();
  long long cnt = 0;
  sort(need1, need1 + tot1);
  sort(need2, need2 + tot2);
  for (int i = 0; i < (T / 2) - tot1; i++) {
    cnt += need2[i];
  }
  for (int i = 0; i < (T / 2) - tot2; i++) {
    cnt += need1[i];
  }
  cout << cnt << endl;
  return 0;
}
