#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main() {
int round;
cin >> round;
while (round--) {
int k, ans = 1;
cin >> k;
if (k < 0) {
k *= (-1);
}
if (k == 0) {
cout << 3 << endl; // 0 = -1-2+3
}
else {
int maximun, n = 1, gap = 0;
for (int i = 1;; i++) {
maximun = (1 + i) * n / 2; // 等差為一的級數
if (maximun >= k) {
break;
}
n++;
}
gap = (maximun - k);
if (gap % 2 == 0) { // in the maximun
cout << n << endl;
}
else if (gap % 2 != 0) { // out of maximun
while (gap % 2 != 0) {
maximun += ++n;
gap = (maximun - k);
}
cout << n << endl;
}
}
cout << endl;
}
return 0;
}