#include using namespace std; int main(void){ int n; cin >> n; if(n>1){ vector F={1,1}; while(true){ int m=(int)F.size(); F.push_back((F[m-1]+F[m-2])%n); if(F.back()==0){ break; } } cout << F.size() << endl; }else{ cout << 1 << endl; } return 0; }