#include <bits/stdc++.h>
using namespace std;
int n;
long long a[200001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  priority_queue<long long, vector<long long>, greater<long long> > differences;
  priority_queue<long long, vector<long long>, greater<long long> >
      differences_2;
  int square_counter = 0;
  for (int i = 0; i < n; i++) {
    long long number = a[i];
    long long square_root = (long long)sqrt(number);
    if (square_root * square_root == number) {
      square_counter++;
      differences_2.push(number == 0 ? 2 : 1);
    } else {
      differences.push(min(number - square_root * square_root,
                           (square_root + 1) * (square_root + 1) - number));
    }
  }
  long long moves = 0;
  while (square_counter < n / 2) {
    square_counter++;
    moves += differences.top();
    differences.pop();
  }
  while (square_counter > n / 2) {
    square_counter--;
    moves += differences_2.top();
    differences_2.pop();
  }
  cout << moves << endl;
}
