#include <bits/stdc++.h>
using namespace std;
long long C2(long long x) { return x * (x - 1) / 2; }
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long n, a = 0;
    cin >> n;
    long long bl = 1, br = n - 1;
    while (bl <= br) {
      long long mid = (bl + br) >> 1;
      long long res = C2(n - mid);
      if (res < mid) {
        a = max(a, mid + res);
        br = mid - 1;
      } else {
        a = max(a, mid + mid);
        bl = mid + 1;
      }
    }
    cout << a << endl;
  }
}
