#include <bits/stdc++.h>
int cmpfunc(const void *a, const void *b) { return (*(int *)a) - (*(int *)b); }
int main() {
  int n, arr[200000], i, r, count = 0;
  long long int result = 0;
  double root;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (i = 0; i < n; i++) {
    root = sqrt((double)arr[i]);
    r = round(root);
    r = r * r;
    r -= arr[i];
    if (arr[i] == 0) count++;
    arr[i] = abs(r);
  }
  qsort(arr, n, sizeof(int), cmpfunc);
  n = n / 2;
  for (i = 0; i < n; i++) {
    if (arr[i] != 0) result += (long long int)arr[i];
  }
  if (result == 0) {
    n = 2 * n;
    for (i = n / 2; i < n; i++) {
      if (arr[i] == 0) result++;
    }
    if (count > n / 2) {
      count -= (n / 2);
      result += (long long int)count;
    }
  }
  printf("%lld", result);
  return 0;
}
