#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; int p1 = 1, p2 = 1; if (n == 1) { cout << 1 << endl; return 0; } for (int i = 3;; i++) { int nex = (p1 + p2) % n; if (nex == 0) { cout << i << endl; return 0; } p1 = p2; p2 = nex; } }