import math
for t in range(int(input())):
n = int(input())
x = int((-3 + (9+8*n)**0.5)/2)
print(2*(n-x) if n>1 else 1)
aW1wb3J0IG1hdGgKZm9yIHQgaW4gcmFuZ2UoaW50KGlucHV0KCkpKToKICAgIG4gPSBpbnQoaW5wdXQoKSkKICAgIHggPSBpbnQoKC0zICsgKDkrOCpuKSoqMC41KS8yKQogICAgcHJpbnQoMioobi14KSBpZiBuPjEgZWxzZSAxKQ==