#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 7, mod = 1000000007;
long long int a[N], b[N], d[N], cnt, sum, mx;
vector<long long int> v;
priority_queue<string> pq;
vector<long long int> u;
long long int kk;
stack<string> st;
long long int vis[N];
map<long long int, long long int> mp;
set<long long int> ss;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int z = 0, n, m = 40, mn = 0, mx = 0, i = 0, x = mod, y = 0, k = 0,
                j = 0, xx, yy;
  string s = "";
  cin >> x;
  mp[x]++;
  x++;
  while (1) {
    if (x == 1) break;
    if (x % 10 != 0) {
      mp[x]++;
      x++;
    } else {
      x = x / 10;
    }
  }
  for (i = x; i < 10; i++) {
    if (mp[i] == 0) {
      mp[i]++;
    }
  }
  cout << mp.size();
}
