#include
using namespace std;
int Kakutani_theorem(int n, int step)
{
if (n == 1)
{
cout << n;
return step;
}
if (n % 2 == 0)
{
step++;
cout << n<<" ";
return Kakutani_theorem(n / 2, step);
}
else {
step++;
cout << n << " ";
return Kakutani_theorem(n*3+1 , step);
}
}
int main()
{
int n = 0;
cin >> n;
cin.clear();
cout << "所有进行过程为: ";
int step=Kakutani_theorem(n,0);
cout << endl;
cout << "步数为: " << step;
return 0;
}