#include #include using namespace std; int main() { long long n = 0, cnt = 0; for (int i = 1; i <= 9; i++) { string P = ""; for (int j = 1; j <= 9; j++) { P += ('0' + i); if (stoll(P) * 1000000001LL <= n)cnt++; } } cout << cnt << endl; return 0; }