#include using namespace std; #define REP(i, n) for(int i = 0; i < (n); i++) using ll = long long; int main(){ ll X; cin >> X; vector A{2, 2, -1, -1, 2, -1, -1}; ll cnt = 0; ll pos = 0; REP(i, 100){ for(auto a: A){ cnt += abs(a); pos += a; if(pos == X){ cout << cnt << endl; return 0; } } } }