#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long dx[] = {-1, 0, 1, 0};
long long dy[] = {0, -1, 0, 1};
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<long long> v;
  for (long long i = 0; i <= 100001; i++) {
    v.push_back(i * i);
  }
  long long n;
  cin >> n;
  vector<long long> val;
  long long sq = 0;
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    if (x == 0) cnt++;
    long long p = sqrt(x);
    if (p * p == x) sq++;
    long long k = upper_bound(v.begin(), v.end(), x) - v.begin();
    long long j = lower_bound(v.begin(), v.end(), x) - v.begin();
    val.push_back(min(abs(x - v[j]), abs(x - v[k - 1])));
  }
  sort(val.begin(), val.end());
  long long ans = 0;
  for (long long i = 0; i < n / 2; i++) ans += val[i];
  if (sq > n / 2) {
    ans += sq - n / 2;
  }
  if (cnt > n / 2) {
    cnt -= n / 2;
    ans += cnt;
  }
  cout << ans << "\n";
}
