#include <iostream>
#include <cmath>
using namespace std;
void func(int dest)
{
int n = sqrt(dest);
int val;
while(1){
val=n*(n+1)/2;
if(val>=dest && (val-dest)%2==0 &&((val-dest)>=n/2 || (val-dest)==0)){cout<<n; break;}
n++;
}
}
int main()
{
int dest;
cin>>dest;
func(abs(dest));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBmdW5jKGludCBkZXN0KQp7CglpbnQgbiA9IHNxcnQoZGVzdCk7CglpbnQgdmFsOwoJd2hpbGUoMSl7CgkJdmFsPW4qKG4rMSkvMjsKCQlpZih2YWw+PWRlc3QgJiYgKHZhbC1kZXN0KSUyPT0wICYmKCh2YWwtZGVzdCk+PW4vMiB8fCAodmFsLWRlc3QpPT0wKSl7Y291dDw8bjsgYnJlYWs7fQoJCW4rKzsKCX0KfQoKaW50IG1haW4oKSAKewoJaW50IGRlc3Q7CgljaW4+PmRlc3Q7CglmdW5jKGFicyhkZXN0KSk7CglyZXR1cm4gMDsKfQ==