#include <bits/stdc++.h>
using namespace std;
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxheap = priority_queue<T>;
template <typename T>
using dpair = pair<T, T>;
template <class T1, class T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
  return is >> p.first >> p.second;
}
template <class T1, class T2>
void operator+=(vector<T1> &v, const T2 &obj) {
  v.push_back(obj);
}
template <class T1>
void operator+=(vector<T1> &v, const T1 &obj) {
  v.push_back(obj);
}
long long get_millis() {
  using namespace std::chrono;
  return duration_cast<milliseconds>(system_clock::now().time_since_epoch())
      .count();
}
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
class range {
 public:
  range(int end) : _start(0), _end(end), _step(1) {}
  range(int start, int end) : _start(start), _end(end), _step(1) {}
  range(int start, int end, int step) : _start(start), _end(end), _step(step) {}
  class iterator {
   public:
    iterator(int v, range &par) : val(v), parent(par){};
    int operator*() const { return val; }
    int operator++() { return (val += parent._step); }
    bool operator==(const range::iterator &iter) const {
      if (&parent != &iter.parent) return false;
      if (val == iter.val) return true;
      if (parent._step > 0)
        return val >= parent._end && iter.val >= parent._end;
      else
        return val <= parent._end && iter.val <= parent._end;
    }
    bool operator!=(const range::iterator &iter) const {
      return !(this->operator==(iter));
    }

   private:
    int val;
    range &parent;
  };
  range::iterator begin() { return {_start, *this}; }
  range::iterator end() { return {_end, *this}; }

 protected:
  int _start, _end, _step;

 private:
};
struct irange : public range {
  irange(int i) : range(1, i + 1) {}
  irange(int i, int j) : range(i, j + 1) {}
};
long long calc(long long N, long long mid) {
  long long bridge = N - mid;
  long long clique = mid * (mid - 1) / 2;
  return min(bridge + clique, bridge * 2);
}
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int Q;
  cin >> Q;
  while (Q--) {
    int N;
    cin >> N;
    int lo = 1, hi = N;
    while (hi - lo > 1) {
      int mid = (lo + hi) / 2;
      long long ans1 = calc(N, mid);
      long long ans2 = calc(N, mid + 1);
      if (ans1 > ans2) {
        hi = mid;
      } else {
        lo = mid;
      }
    }
    cout << max(calc(N, lo + 1), (long long)N - 1) << "\n";
  }
}
