#include <iostream>

using namespace std;

int main() {
int N;
cin >> N; int one = 0;
int two = 1;
while (1) {
if (N >= one && N <= two) {
cout << min(two - N, N - one) << endl;
break;
}
int sum = one + two;
one = two;
two = sum;
}
return 0;
}
05-22 06:13