#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
inline int getint() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long getlng() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int dx4[] = {-1, 0, 1, 0};
int dy4[] = {0, 1, 0, -1};
int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const double eps = (double)1e-9;
const int N = 2e5 + 5;
long long arr[N], f[N];
int n;
bool issq(long long x) {
  long long s = sqrt(x * 1.0);
  return s * s == x;
}
long long need(long long x) {
  if (issq(x)) return 0;
  long long s = sqrt(x * 1.0);
  long long a = s * s;
  long long b = (s + 1) * (s + 1);
  return min(x - a, b - x);
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second == b.second) return a.first < b.first;
  return a.second < b.second;
}
int main() {
  n = getint();
  vector<pair<long long, long long> > vp;
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%lld", &x);
    vp.push_back(make_pair(x, need(x)));
  }
  sort((vp).begin(), (vp).end(), cmp);
  long long ans = 0;
  for (int i = 0; i < (n >> 1); ++i) {
    ans += vp[i].second;
  }
  for (int i = (n >> 1); i < n; ++i) {
    if (vp[i].first == 0)
      ans += 2;
    else if (vp[i].first == 1)
      ++ans;
    else if (issq(vp[i].first))
      ++ans;
  }
  cout << ans;
  return 0;
}
