#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
template <typename T>
static T aabs(T x) {
  if (x < 0) return -x;
  return x;
}
template <typename T, typename U>
static void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
static void amin(T &x, U y) {
  if (x > y) x = y;
}
template <typename T, typename U>
static long long gcd(T a, U b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <typename T, typename U>
static long long lcm(T a, U b) {
  return a / gcd(a, b) * b;
}
template <typename T, typename U>
static long long fpow(T n, U k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
int main() {
  int n, mid;
  scanf("%d", &n);
  long long ans;
  ans = 0;
  mid = n / 2;
  vector<int> a(n), f(n);
  for (int i = 0; i < (n); i++) {
    int x;
    scanf("%d", &x);
    int square, dis;
    square = sqrt(x);
    if (square * square == x) {
      if (x == 0)
        a[i] = -1;
      else
        a[i] = 0;
      continue;
    }
    dis = min(aabs(x - square * square), aabs((square + 1) * (square + 1) - x));
    a[i] = dis;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < (mid); i++)
    if (a[i] != -1) ans += 1LL * a[i];
  if (a[mid] == 0 || a[mid == -1]) {
    for (int i = mid; i < n; i++) {
      if (a[i] == -1)
        ans += 2;
      else if (a[i] == 0)
        ++ans;
      else
        break;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
