#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int n;
inline LL calc(int k) {
  return (LL)(n - k) + min((LL)k * (k - 1) / 2, (LL)(n - k));
}
int check(int k) {
  if (k == 1) return 1;
  if (k == n) return -1;
  LL lt = calc(k - 1), md = calc(k), rt = calc(k + 1);
  if ((lt <= md && md < rt) || (lt < md && md <= rt)) return 1;
  if ((lt >= md && md > rt) || (lt > md && md >= rt)) return -1;
  return 0;
}
LL solve(int x) {
  if (x <= 5) return x - 1;
  int l = 1, r = x;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (check(mid) == 0)
      return calc(mid);
    else if (check(mid) > 0)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return calc(l);
}
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &n);
    printf("%lld\n", solve(n));
  }
  return 0;
}
