#include <bits/stdc++.h>
using namespace std;
void display(vector<int> v1) {
  for (long long int i = 0; i < v1.size(); i++) {
    cout << v1[i] << " ";
  }
  cout << endl;
}
long long int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
long long int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};
long long int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int q;
  cin >> q;
  while (q--) {
    cin >> n;
    long long int high = n;
    long long int low = 1;
    while (high - low > 1) {
      long long int mid = (high + low) / 2;
      long long int nums = mid * (mid - 1) / 2;
      if (nums > n - mid) {
        high = mid;
      } else {
        low = mid;
      }
    }
    cout << max((low * (low - 1)) / 2 + n - low, (n - high) * 2) << endl;
  }
  return 0;
}
