20pts
#include <bits/stdc++.h> using namespace std; //0 1 2 3 4 5 //0 0 1 2 2 3 int main() { int n, a[1000001] = {0, 0, 1, 2, 2, 3}; cin >> n; for (int i = 6; i <= n; i++) { a[i] = min(a[i - 1], a[i / 2]) + 1; } cout << a[n]; return 0; }