#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, sum = 0, x, count = 0, z, count1;
  cin >> n;
  long long int A[n], B[n];
  for (i = 0; i < n; i++) cin >> A[i];
  for (i = 0; i < n; i++) {
    x = sqrt(A[i]);
    if (x * x == A[i]) count++;
  }
  if (count <= n / 2) {
    for (i = 0; i < n; i++) {
      x = sqrt(A[i]);
      B[i] = min(abs(x * x - A[i]), abs((x + 1) * (x + 1) - A[i]));
    }
    sort(B, B + n);
    for (i = 0; i < n / 2; i++) sum += B[i];
    cout << sum << endl;
  } else {
    long long int C[count], j = 0;
    z = 0;
    for (i = 0; i < n; i++) {
      x = sqrt(A[i]);
      if (x * x == A[i]) {
        C[j] = A[i];
        j++;
      }
    }
    for (i = 0; i < count; i++) {
      if (C[i] == 0) z++;
    }
    count1 = count - n / 2;
    if ((count - z) >= count1)
      sum = (count1);
    else
      sum = (count - z) + 2 * (count1 - count + z);
    cout << sum << endl;
  }
  return (0);
}
