#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; if(N == 1){cout << 1 << endl; return 0;} int a1 = 1,a2 = 1; for(int i=3; ; i++){ int now = (a1+a2)%N; if(now == 0){cout << i << endl; return 0;} a1 = a2,a2 = now; } }