#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int l = 1, h = n;
    long long int ans = 0;
    while (l <= h) {
      long long int mid = (l + h) / 2;
      long long int c1 = (mid * (mid - 1)) / 2;
      long long int c2 = n - mid;
      if (c2 >= c1)
        ans = mid, l = mid + 1;
      else
        h = mid - 1;
    }
    long long int dis;
    long long int c1 = (ans * (ans - 1)) / 2;
    long long int c2 = n - ans;
    if (c1 == c2)
      dis = c1 + c2;
    else {
      dis = max(c1 + c2, 2 * (c2 - 1));
    }
    cout << dis << "\n";
  }
  return 0;
}
