#include using namespace std; //*/ #include using namespace atcoder; //*/ #define rep(i,n) for(int i=0;i; using ll = long long; using ull = unsigned long long; //*/ template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef pair pii; typedef pair pll; typedef vector vll; typedef vector vint; random_device rnd; mt19937 rng(rnd()); void solve(){ int n; cin >> n; vll tmp(10001,0); tmp[1] = tmp[2] = 1; ll prev = -1; for(int i = 3;i < 10000;i++){ tmp[i] = (tmp[i-1]+tmp[i-2])%n; if(prev == -1 && tmp[i] == 0) prev = i; else if(tmp[i] == 0){ cout << i-prev << endl; return; } } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin >> t; rep(testcases,t) solve(); }