#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long solve(long long n) {
  if (n == 0) return 0;
  long long app, g1, g2, g3, g4, c1, c2, c3, c4, c5, ans;
  app = sqrt(n);
  g1 = app - 2;
  g2 = app - 1;
  g3 = app + 1;
  g4 = app + 2;
  c1 = abs(n - (g1 * g1));
  c2 = abs(n - (g2 * g2));
  c3 = abs(n - (g3 * g3));
  c4 = abs(n - (g4 * g4));
  c5 = abs(n - (app * app));
  ans = min(min(min(c1, c2), min(c3, c4)), c5);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, x, sum = 0, c1 = 0, c2 = 0;
  cin >> n;
  vector<pair<long long, long long> > v;
  for (long long int i = 1; i <= n; i++) {
    cin >> x;
    v.push_back(make_pair(solve(x), x));
  }
  sort(v.begin(), v.end());
  for (long long int i = 0; i <= n - 1; i++) {
    if (v[i].first == 0)
      c1++;
    else
      c2++;
  }
  if (c1 == c2)
    sum = 0;
  else if (c1 > (n / 2)) {
    for (long long int i = n / 2 + 1; i <= c1; i++) {
      if (v[i - 1].second != 0)
        sum += 1;
      else
        sum += 2;
    }
  } else {
    for (long long int i = 0; i <= n / 2 - 1; i++) sum += v[i].first;
  }
  cout << sum;
  return 0;
}
