#include <bits/stdc++.h>
using namespace std;
int n, a[200005];
int minstep[200005];
int judge[200005];
int maybe[200005];
int cnt_zero;
int main() {
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    if (a[i] == (int)sqrt(a[i]) * (int)sqrt(a[i])) {
      cnt++;
      judge[i] = 1;
      if (a[i] == 0) cnt_zero++;
    } else {
      minstep[i] = min(a[i] - (int)sqrt(a[i]) * (int)sqrt(a[i]),
                       ((int)sqrt(a[i]) + 1) * ((int)sqrt(a[i]) + 1) - a[i]);
    }
  }
  long long step = 0;
  int tot = 0;
  if (cnt == n / 2) {
    printf("0\n");
    return 0;
  } else if (cnt > n / 2) {
    if (cnt - cnt_zero >= cnt - n / 2) {
      step = cnt - n / 2;
    } else {
      step = cnt - cnt_zero + (cnt_zero - n / 2) * 2;
    }
  } else {
    for (int i = 1; i <= n; i++) {
      if (judge[i] == 1)
        continue;
      else
        maybe[++tot] = minstep[i];
    }
    sort(maybe + 1, maybe + tot + 1);
    for (int i = 1; i <= n / 2 - cnt; i++) step += maybe[i];
  }
  printf("%I64d\n", step);
  return 0;
}
