#include <bits/stdc++.h>   using namespace std;   long long n, mx, now, ans;   int main() {     scanf( %lld , &n);     mx = 2 * n - 1;     while (now * 10 + 9 <= mx) now = now * 10 + 9;     for (long long k = now; k <= mx; k += now + 1) {       long long d = max(k - n, 1ll), u = max(k - d, d);       ans += (u - d + 1) / 2;     }     printf( %lld n , ans);     return 0;   }   