#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long sq[n], nsq[n];
  vector<std::pair<long long, long long> > v;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    long long x = sqrt(a[i]);
    if (x * x == a[i]) {
      sq[i] = 0;
      if (x != 0)
        nsq[i] = 1;
      else
        nsq[i] = 2;
    } else {
      nsq[i] = 0;
      sq[i] = min(a[i] - x * x, (x + 1) * (x + 1) - a[i]);
    }
    sum += nsq[i];
    v.push_back(make_pair(sq[i] - nsq[i], i));
  }
  sort(v.begin(), v.end());
  for (long long i = 0; i < n / 2; i++) sum += v[i].first;
  cout << sum << "\n";
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) solve();
}
