#include <bits/stdc++.h>
using namespace std;
int a[200001];
int b[200001];
int c[200001];
int main() {
  long long n;
  long long sum = 0;
  long long lishn = 0;
  cin >> n;
  long long nol = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    double m = sqrt(a[i]);
    long long k = round(m);
    b[i] = abs(k * k - a[i]);
    if (a[i] == 0) lishn++;
    if (b[i] == 0) {
      nol++;
    }
  }
  sort(b, b + n);
  if (nol > n / 2) {
    long long ke = nol - n / 2;
    if ((nol - lishn) < nol - n / 2) {
      cout << nol - lishn + (nol - n / 2 - nol + lishn) * 2 << endl;
      return 0;
    }
    cout << ke << endl;
    return 0;
  }
  for (int i = 0; i < n / 2; i++) {
    sum += b[i];
  }
  cout << sum << endl;
  return 0;
}
