Problem: You are given a positive integer n.

Let S(x) be sum of digits in base 10 representation of x, for example, S(123) = 1 + 2 + 3 = 6, S(0) = 0.

Your task is to find two integers a, b, such that 0 ≤ a, b ≤ n, a + b = n and S(a) + S(b) is the largest possible among all such pairs.

Input

The only line of input contains an integer n (1 ≤ n ≤ 10^{12}).

Output

Print largest S(a) + S(b) among all pairs of integers a, b, such that 0 ≤ a, b ≤ n and a + b = n.

Examples

Input

35


Output

17


Input

10000000000


Output

91

Note

In the first example, you can choose, for example, a = 17 and b = 18, so that S(17) + S(18) = 1 + 7 + 1 + 8 = 17. It can be shown that it is impossible to get a larger answer.

In the second test example, you can choose, for example, a = 5000000001 and b = 4999999999, with S(5000000001) + S(4999999999) = 91. It can be shown that it is impossible to get a larger answer.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long INF = 9e18;
const int inf = 2147483647;
long long phi(long long n) {
  long long ans = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      ans = ans / i * (i - 1);
      while (n % i == 0) n /= i;
    }
  }
  if (n > 1) ans = ans / n * (n - 1);
  return ans;
}
long long qpow(long long a, long long b, long long mod) {
  long long r = 1;
  for (; b; b >>= 1) {
    if (b & 1) r = (r * a) % mod;
    a = (a * a) % mod;
  }
  return r;
}
long long C(int n, int m) {
  if (m < n - m) m = n - m;
  long long ans = 1;
  for (int i = m + 1; i <= n; i++) ans *= i;
  for (int i = 1; i <= n - m; i++) ans /= i;
  return ans;
}
const int N = 2e3 + 5;
void work() {
  long long n;
  cin >> n;
  long long m = n;
  int cnt = 0;
  long long a;
  while (m) {
    if (m < 10) a = m;
    cnt++, m /= 10;
  }
  if (cnt) cnt--;
  int t = cnt;
  long long ta = a;
  while (cnt--) {
    a *= 10;
    a += 9;
  }
  if (a > n) {
    ta--;
    while (t--) {
      ta *= 10;
      ta += 9;
    }
    a = ta;
  }
  long long b = n - a;
  int ans = 0;
  while (a) {
    ans += a % 10;
    a /= 10;
  }
  while (b) {
    ans += b % 10;
    b /= 10;
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  work();
  return 0;
}