#include <bits/stdc++.h>
using namespace std;
long long const MAXN = 2e5 + 10;
long long n, m, T;
long long a[MAXN], is_fang[MAXN], no_fang[MAXN];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    long long t1 = (long long)sqrt(a[i]);
    long long t2 = t1 + 1;
    is_fang[i] = min(a[i] - t1 * t1, t2 * t2 - a[i]);
    if (t1 * t1 == a[i]) {
      no_fang[i] = a[i] ? 1 : 2;
      cnt++;
    } else
      no_fang[i] = 0;
  }
  if (cnt * 2 <= n) {
    long long ans = 0;
    long long num = n / 2 - cnt;
    sort(is_fang + 1, is_fang + 1 + n);
    for (long long i = 1; i <= n && num; i++) {
      if (!is_fang[i]) continue;
      ans += is_fang[i];
      num--;
    }
    cout << ans;
  } else {
    sort(no_fang + 1, no_fang + 1 + n);
    long long ans = 0;
    long long num = cnt - n / 2;
    for (long long i = 1; i <= n && num; i++) {
      if (!no_fang[i]) continue;
      ans += no_fang[i];
      num--;
    }
    cout << ans;
  }
  return 0;
}
