import sys
input=sys.stdin.readline
def inp():
return int(input())
def st():
return input().rstrip('\n')
def lis():
return list(map(int,input().split()))
def ma():
return map(int,input().split())
t=1
while(t):
t-=1
n=inp()
n=abs(n+0)
cur=1
mo=0
x=0
while(1):
if((x+cur)<n):
cur+=1
mo+=1
x+=cur-1
else:
cur+=1
mo+=1
x+=cur-1
break
if((x-n)%2):
x+=cur
if((x-n)%2==0):
mo+=1
else:
mo+=2
if(n==0):
mo=0
print(mo)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key
#define ld long double
#define vll vector<int>
#define vpl vector<pair<int, int>>
#define pb push_back
#define all(n) n.begin(), n.end()
#define rev(n) reverse(n.begin(), n.end())
#define fr(n) for(int i=0; i<n; i++)
#define frl(k,n) for(int j=k; j<n; j++)
#define cinv(a,n) for(int j=0;j<n;j++) cin>>a[j]
#define yn(x) cout << ((x) ? "YES\n" : "NO\n")
#define endl '\n'
const int M = 1e9+7;
bool poweroftwo(int n) { return !(n & (n - 1)); }
int pow(int a, int b, int m=M) {int ans=1;while (b){if(b&1) ans=(ans*a)%m; a=(a*a)%m; b >>= 1;}return ans;}
// const int N = 4e4;
// bool seive[N]; vector<int> primes;
// void know_all_primes(){for(int i = 2; i < N; ++i){seive[i] = true;}for(int i = 2; i < N; ++i){if (seive[i]) {primes.push_back(i);for(int j = i *i; j < N; j += i){seive[j] = false;}}}}
vector<int> know_all_prime(int num) { vector<int> ans; for(int i=2; i*i<=num; i++) { if(num%i==0) { ans.push_back(i);} while (num % i == 0) { num /= i;}} if (num > 1){ ans.push_back(num); } return ans; }
mt19937 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
void testCase(){
int n = 0, m = 0, c = 0, k = -1, sum = 0; string s; bool f = true;
cin >> k;
k = abs(k);
m = 2*k;
c = sqrt(m);
n = c*(c+1);
if(n == m) {
cout << c << endl; return;
}
if(n/2 > k) c--;
n = c*(c+1)/2;
sum = k - n;
if(sum&1 and c&1) cout << c+2 << endl;
else if(sum%2==0 and c%2==0) cout << c+3 << endl;
else cout << c+1 << endl;
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int test = 1;
// cin >> test;
while(test--) {testCase();}
return 0;
}
162. Find Peak Element | 1529A - Eshag Loves Big Arrays |
19. Remove Nth Node From End of List | 925. Long Pressed Name |
1051. Height Checker | 695. Max Area of Island |
402. Remove K Digits | 97. Interleaving String |
543. Diameter of Binary Tree | 124. Binary Tree Maximum Path Sum |
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | 501A - Contest |
160A- Twins | 752. Open the Lock |
1535A - Fair Playoff | 1538F - Interesting Function |
1920. Build Array from Permutation | 494. Target Sum |
797. All Paths From Source to Target | 1547B - Alphabetical Strings |
1550A - Find The Array | 118B - Present from Lena |
27A - Next Test | 785. Is Graph Bipartite |
90. Subsets II | 1560A - Dislike of Threes |
36. Valid Sudoku | 557. Reverse Words in a String III |
566. Reshape the Matrix | 167. Two Sum II - Input array is sorted |