#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)(2e5 + 123);
const long long INF = (long long)2e9;
long long a[MAXN];
pair<long long, long long> b[MAXN];
tuple<long long, long long> squares(long long x) {
  long long l = 0, r = INF, mid = 0;
  tuple<long long, long long> ans = {0, 0};
  while (l <= r) {
    mid = (l + r) / (long long)2;
    if (mid * mid <= x) {
      l = mid + 1;
      get<0>(ans) = mid * mid;
    } else {
      r = mid - 1;
      get<1>(ans) = mid * mid;
    }
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int cnt1 = 0, cnt2 = 0;
  for (int i = 1; i <= n; i++) {
    double val = sqrt(a[i]);
    if (int(val) - val == 0) {
      b[i] = {(a[i] == 0) ? 2 : 1, 0};
      cnt1++;
    } else {
      cnt2++;
      auto [low, high] = squares(a[i]);
      b[i] = {0, min(a[i] - low, high - a[i])};
    }
  }
  sort(b + 1, b + 1 + n);
  long long ans = 0;
  if (cnt1 < cnt2) {
    int fn = cnt2 - n / 2;
    for (int i = 1; i <= fn; i++) ans += b[i].second;
  } else {
    int st = cnt2 + 1;
    for (int i = st; i < st + (cnt1 - n / 2); i++) ans += b[i].first;
  }
  cout << ans << endl;
  return 0;
}
