Ivan is developing his own computer game. Now he tries to create some levels for his game. But firstly for each level he needs to draw a graph representing the structure of the level.

Ivan decided that there should be exactly ni vertices in the graph representing level i, and the edges have to be bidirectional. When constructing the graph, Ivan is interested in special edges called bridges. An edge between two vertices u and v is called a bridge if this edge belongs to every path between u and v (and these vertices will belong to different connected components if we delete this edge). For each level Ivan wants to construct a graph where at least half of the edges are bridges. He also wants to maximize the number of edges in each constructed graph.

So the task Ivan gave you is: given q numbers n1, n2, ..., nq, for each i tell the maximum number of edges in a graph with ni vertices, if at least half of the edges are bridges. Note that the graphs cannot contain multiple edges or self-loops.

Input

The first line of input file contains a positive integer q (1 ≤ q ≤ 100 000) — the number of graphs Ivan needs to construct.

Then q lines follow, i-th line contains one positive integer ni (1 ≤ ni ≤ 2·109) — the number of vertices in i-th graph.

Note that in hacks you have to use q = 1.

Output

Output q numbers, i-th of them must be equal to the maximum number of edges in i-th graph.

Example

Input

3
3
4
6


Output

2
3
6

Note

In the first example it is possible to construct these graphs:

  1. 1 - 2, 1 - 3; 
  2. 1 - 2, 1 - 3, 2 - 4; 
  3. 1 - 2, 1 - 3, 2 - 3, 1 - 4, 2 - 5, 3 - 6. 
#include <bits/stdc++.h>
using namespace std;
long long n;
bool cau(long long k) {
  if (k * (k - 1) / 2 > n - k)
    return true;
  else
    return false;
}
long long ternsearch(long long l, long long r) {
  long long mid = (l + r) >> 1;
  long long sum = 0;
  if (cau(mid))
    sum = 2 * n - 2 * mid;
  else
    sum = n - mid + mid * (mid - 1) / 2;
  while (l <= r) {
    mid = (l + r) >> 1;
    long long midl = (l + mid) >> 1;
    long long midr = (r + mid) >> 1;
    long long now = 0, sum1 = 0, sum2 = 0;
    if (cau(mid))
      now = 2 * n - 2 * mid;
    else
      now = n - mid + mid * (mid - 1) / 2;
    sum = max(sum, now);
    if (cau(midl))
      sum1 = 2 * n - 2 * midl;
    else
      sum1 = n - midl + midl * (midl - 1) / 2;
    sum = max(sum1, sum);
    if (cau(midr))
      now = 2 * n - 2 * midr;
    else
      now = n - midr + midr * (midr - 1) / 2;
    sum = max(sum2, sum);
    if (cau(midl) && cau(midr))
      r = mid - 1;
    else if (!cau(midl) && !cau(midr))
      l = mid + 1;
    else {
      if (sum1 < sum2)
        r = midr - 1;
      else
        l = midl + 1;
    }
  }
  return sum;
}
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    scanf("%lld", &n);
    printf("%lld\n", ternsearch(1, n));
  }
  return 0;
}
