#include <bits/stdc++.h>
using namespace std;
long long int up[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, j, r, f, e, x, y, mid, z, w, k, h, a, b, c;
  long long int t1, t2, t3, ans = 0, tc, t, t4;
  long long int n, l, q;
  cin >> q;
  vector<long long int> v;
  t1 = 4;
  l = 2;
  while (t1 + l <= 2e9) {
    v.push_back(t1 + l);
    t1 += l;
    l++;
  }
  while (q--) {
    cin >> n;
    if (n < 6) {
      cout << n - 1 << endl;
      continue;
    }
    x = upper_bound(v.begin(), v.end(), n) - v.begin();
    x--;
    t1 = x + 1;
    t2 = (x * (x + 1)) / 2;
    t1 = min(t1, n - v[x] + 1);
    ans = n - 1 + t2 + t1;
    cout << ans << endl;
  }
  return 0;
}
