#include using namespace std; const int MOD = 998244353; int main() { int N; cin >> N; if (N == 1) { cout << 1 << endl; return 0; } vector F = {1, 1}; int i = 2; while (1) { F.push_back((F[i - 2] + F[i - 1]) % N); if (F[i] % N == 0) { break; } i++; } cout << i + 1 << endl; }