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;
vector<int> prime, primeFactor;
bool flg = true;
bool flag = true;
template <typename T>
inline bool isPrime(T n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 | n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i += 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
template <typename T>
inline void sieve(T N) {
  int status[(N >> 5) + 2];
  memset(status, 0, ((N >> 5) + 2) << 2);
  for (int i = 3; i * i <= N; i += 2)
    if (!(status[i >> 5] & (1 << (i & 31))))
      for (int j = i * i; j <= N; j += (i << 1))
        status[j >> 5] |= (1 << (j & 31));
  prime.push_back(2);
  for (int i = 3; i <= N; i += 2) {
    if (!(status[i >> 5] & (1 << (i & 31)))) prime.push_back(i);
    if (!(N % i)) flg = false;
  }
}
template <typename T>
inline void factorization(T N) {
  if (flg) {
    primeFactor.push_back(N);
    return;
  }
  int Size = 0;
  int sqrtN = int(sqrt(N));
  while (N >= 1 && Size != prime.size() && prime[Size] <= sqrtN) {
    while (N % prime[Size] == 0) {
      primeFactor.push_back(prime[Size]);
      N /= prime[Size];
    }
    Size++;
  }
  if (N > 1) primeFactor.push_back(N);
}
template <typename T>
inline T gcd(T a, T b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
template <typename T>
inline T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <typename T>
inline T mmul(T a, T b, T m) {
  T result = 0;
  a %= m;
  while (b) {
    if (b % 2) result = (result + a) % m;
    a = (a + a) % m;
    b /= 2;
  }
  return result;
}
template <typename T>
inline T bigMod(T a, T b, T m) {
  T result = 1;
  a %= m;
  while (b) {
    if (b % 2) result = mmul(result, a, m);
    a = mmul(a, a, m);
    b /= 2;
  }
  return result;
}
template <typename T>
inline T negMod(T n, T m) {
  return (n % m + m) % m;
}
template <typename T>
inline T bigMul(T a, T b, T m) {
  if (b == 0) return 0;
  T x = bigMul(a, b >> 1, m);
  x = ((x % m) + (x % m)) % m;
  if (b & 1) x = (x + (a % m)) % m;
  return x;
}
template <typename T>
inline T StoI(string s, T ret) {
  stringstream ss(s);
  ss >> ret;
  return ret;
}
template <typename T>
inline string ItoS(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <typename T>
inline T MIN3(T x, T y, T z) {
  T Min = y ^ ((x ^ y) & -(x < y));
  Min = z ^ ((Min ^ z) & -(Min < z));
  return Min;
}
template <typename T>
inline T MAX3(T x, T y, T z) {
  T Max = x ^ ((x ^ y) & -(x < y));
  Max = Max ^ ((Max ^ z) & -(Max < z));
  return Max;
}
template <typename T>
inline T BtoD(T x) {
  T two = 1, intn = 0;
  while (x) {
    if (x % 10) intn += two;
    x /= 10;
    two <<= 1;
  }
  return intn;
}
inline unsigned long long int BtoD(string str) {
  unsigned long long int intS = 0, two = 1;
  int len = str.length();
  for (int i = len - 1; i >= 0; i--) {
    if (str.at(i) == '1') intS += two;
    two <<= 1;
  }
  return intS;
}
inline string DtoB(unsigned long long int n) {
  int count = 0;
  string s = "";
  for (int i = 31; i >= 0; i--) {
    int k = n >> i;
    if (k & 1) {
      count = 1;
      s += '1';
    } else {
      if (count == 1) s += '0';
    }
  }
  return s;
}
template <typename T>
inline void in(T &x) {
  x = 0;
  bool neg = false;
  register char c = getchar();
  while ((c < 48 || c > 57) && c != EOF && c != '-') c = getchar();
  if (c == '-') {
    neg = true;
    c = getchar();
  }
  while (c >= 48 && c <= 57) {
    x = (x << 3) + (x << 1) + c - 48;
    c = getchar();
  }
  if (neg) x = ~(x - 1);
}
template <typename T>
inline T in2(T &a, T &b) {
  in(a);
  in(b);
}
template <typename T>
inline T in3(T &a, T &b, T &c) {
  in(a);
  in(b);
  in(c);
}
template <typename T>
inline void out(T x) {
  char a[21];
  T i = 1, j;
  if (x < 0) {
    putchar('-');
    x = ~(x - 1);
  }
  if (x == 0) putchar('0');
  while (x) {
    a[i++] = x % 10 + 48;
    x /= 10;
  }
  for (j = i - 1; j >= 1; j--) putchar(a[j]);
}
inline long long int Rem(string q, long long int r) {
  long long int l = q.size();
  long long int remainder = 0;
  for (int i = 0; i < l; i++)
    remainder = ((remainder * 10) + (q.at(i) - '0')) % r;
}
inline long long int quotient(string num, long long int number) {
  long long l, x = 0, mod = 0;
  l = num.size();
  int print_done = 0;
  for (int i = 0; i < l; i++) {
    mod = (mod * 10 + num.at(i) - '0');
    if (mod < number && !print_done) continue;
    x = (x * 10) + (mod / number);
    print_done = 1;
    mod = mod % number;
  }
  return x;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  return (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E');
  return false;
}
bool isConsonant(char ch) {
  return (isalpha(ch) && !isVowel(ch));
  return false;
}
using namespace std;
long long int SumofDigits(long long int num) {
  long long int sum = 0;
  while (num != 0) {
    sum = sum + num % 10;
    num = num / 10;
  }
  return sum;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  long long int x = StoI(s, x), y, z;
  z = x;
  if (x % 2)
    x = x / 2 + 1;
  else
    x = x / 2;
  s = ItoS(x);
  for (int i = 1; i < s.size(); i++) {
    if (s.at(i) != '9') s.at(i) = '9';
  }
  x = StoI(s, x);
  y = z - x;
  cout << SumofDigits(x) + SumofDigits(y) << endl;
  return 0;
}