#include <bits/stdc++.h>
using namespace std;
const int M = 35000;
const int N = 2e5 + 10;
struct node {
  int num, no;
};
node c[N];
int n;
int s[N], a[N], b[N];
bool cmp(node node1, node node2) { return node1.num < node2.num; }
int main() {
  int i, p, x;
  long long ans = 0;
  for (i = 0; i <= M; i++) s[i] = i * i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    p = lower_bound(s + 0, s + M + 1, x) - s;
    if (s[p] == x) {
      b[i] = 0;
      if (x == 0)
        a[i] = 2;
      else
        a[i] = 1;
    } else {
      a[i] = 0;
      b[i] = min(s[p] - x, x - s[p - 1]);
    }
    c[i].num = b[i] - a[i];
    c[i].no = i;
  }
  sort(c + 1, c + n + 1, cmp);
  for (i = 1; i <= n / 2; i++) ans += b[c[i].no];
  for (i = n / 2 + 1; i <= n; i++) ans += a[c[i].no];
  printf("%lld\n", ans);
  return 0;
}
