#include <bits/stdc++.h>
using namespace std;
vector<pair<long, long> > v;
int main() {
  long long n, m, x, low, up;
  scanf("%lld", &n);
  m = n / 2;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &x);
    low = sqrt(x);
    up = low + 1;
    low = low * low;
    up = up * up;
    v.push_back(pair<long, long>(min(up - x, x - low), x));
  }
  long long ans = 0;
  sort(v.begin(), v.end());
  for (int i = 0; i < m; i++) ans += v[i].first;
  for (int i = m; i < n; i++) {
    if (v[i].first == 0) {
      ans++;
      if (v[i].second == 0) ans++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
