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>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = 1000001000;
const long long INFLL = INF * 1LL * INF;
const int mod = 1000 * 1000 * 1000 + 7;
const int mod9 = 1000 * 1000 * 1000 + 9;
const int modr = 99990001;
const long double PI = 3.1415926535897932385;
template <class T>
void zero(T val, T& first) {
  first = val;
}
template <class T, class... Targs>
void zero(T val, T& first, Targs&... Fargs) {
  first = val;
  zero(val, Fargs...);
}
template <class T, class T2>
std::istream& operator>>(std::istream& is, pair<T, T2>& p) {
  return is >> p.first >> p.second;
}
template <class T>
std::istream& readN(T& first, int n, int st = 0) {
  for (int i = st, iend = (st + n - 1); i <= iend; i++) cin >> first[i];
  return cin;
}
template <class T>
std::istream& readS(set<T>& first, int n) {
  T second = *first.rbegin();
  for (int i = 0, iend = (n - 1); i <= iend; i++) {
    cin >> second;
    first.insert(second);
  }
  return cin;
}
template <class T>
std::istream& read(T& first) {
  return cin >> first;
}
template <class T, class... Targs>
std::istream& read(T& first, Targs&... Fargs) {
  return read(first), read(Fargs...);
}
template <class T, class T2>
std::ostream& operator<<(std::ostream& os, pair<T, T2> p) {
  return os << p.first << " " << p.second;
}
template <class T>
std::ostream& operator<<(std::ostream& os, vector<T> v) {
  bool f = true;
  for (auto second : v) {
    if (!f) os << ' ';
    os << second;
    f = false;
  }
  return os;
}
template <class T>
std::ostream& operator<<(std::ostream& os, set<T> v) {
  bool f = true;
  for (auto second : v) {
    if (!f) os << ' ';
    os << second;
    f = false;
  }
  return os;
}
template <class T>
std::ostream& operator<<(std::ostream& os, multiset<T> v) {
  bool f = true;
  for (auto second : v) {
    if (!f) os << ' ';
    os << second;
    f = false;
  }
  return os;
}
template <class T, class T2>
std::ostream& operator<<(std::ostream& os, map<T, T2> v) {
  bool f = true;
  for (pair<T, T2> second : v) {
    if (!f) os << ' ';
    os << second.first << "=>" << second.second;
    f = false;
  }
  return os;
}
template <class T>
std::ostream& outV(T first, char del = ' ') {
  bool f = true;
  for (auto second : first) {
    if (!f) cout << del;
    cout << second;
    f = false;
  }
  return cout;
}
template <class T>
std::ostream& outN(T first, int n = -1, int st = 0) {
  for (int i = st, iend = (n == -1 ? (int)first.size() - 1 : st + n - 1);
       i <= iend; i++) {
    cout << first[i];
    if (i < iend) cout << ' ';
  }
  return cout;
}
template <class T>
std::ostream& outAN(T first, int n = -1, int st = 0) {
  for (int i = st, iend = (n - 1); i <= iend; i++) {
    cout << first[i];
    if (i < iend) cout << ' ';
  }
  return cout;
}
template <class T>
std::ostream& outA2(T first, int n, int m) {
  for (int i = 0, iend = (n - 1); i <= iend; i++) {
    for (int j = 0, jend = (m - 1); j <= jend; j++)
      cout << first[i][j] << (j == m - 1 ? '\n' : ' ');
  }
  return cout;
}
template <class T>
std::ostream& out(T first) {
  return cout << first;
}
template <class T, class... Targs>
std::ostream& out(T first, Targs... Fargs) {
  return out(first) << " ", out(Fargs...);
}
template <typename T>
void srt(T& a, int st, int fn, bool isArr) {
  sort(a + st, a + fn + 1);
}
template <class T>
void srt(T& a, int st = 0, int fn = 0) {
  sort(a.begin() + st, fn ? a.begin() + fn + 1 : a.end());
}
template <typename T>
T rev_num(T a) {
  T r = 0;
  for (; a; a /= 10) r = r * 10 + a % 10;
  return r;
}
template <typename T>
T sum_num(T a) {
  T r = 0;
  for (; a; a /= 10) r += a % 10;
  return r;
}
template <typename T>
void rev(T& a, int st, int fn, bool isArr) {
  reverse(a + st, a + fn + 1);
}
template <class T>
void rev(T& a, int st = 0, int fn = 0) {
  reverse(a.begin() + st, fn ? a.begin() + fn + 1 : a.end());
}
long long sqr(long long a) { return a * a; };
long long sqr(int a) { return a * 1LL * a; };
long double sqr(long double a) { return a * a; };
long long phi(int n) {
  int res = n;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      res -= res / i;
    }
  if (n > 1) res -= res / n;
  return res;
}
long long bpm(long long a, long long n = -2, long long m = mod) {
  n = n < 0 ? n + m : n;
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * a) % m;
    a = (a * a) % m;
    n >>= 1;
  }
  return r;
}
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
vector<int> ero_p, ero_l;
void ero(int n) {
  ero_l.resize(n + 1);
  ero_l[0] = -1;
  for (int i = 2, iend = (n); i <= iend; i++)
    if (!ero_l[i]) {
      ero_p.push_back(i);
      ero_l[i] = i;
      for (long long j = i * 1LL * i; j <= n; j += i) {
        ero_l[j] = i;
      }
    }
}
long long gcd_cb(long long a, long long b, long long& first,
                 long long& second) {
  if (!b) {
    first = 1;
    second = 0;
    return a;
  }
  long long x1, y1, g;
  g = gcd_cb(b, a % b, x1, y1);
  first = y1;
  second = x1 - a / b * y1;
  return g;
}
vector<long long> fact;
void fact_prec(int n = 20) {
  fact.resize(n + 1);
  fact[0] = 1;
  for (int i = 1, iend = (n); i <= iend; i++) {
    fact[i] = fact[i - 1] * i;
  }
}
vector<long double> factd;
void fact_precd(int n = 146) {
  factd.resize(n + 1);
  factd[0] = 1;
  for (int i = 1, iend = (n); i <= iend; i++) {
    factd[i] = factd[i - 1] * i;
  }
}
string str(long long a) {
  string r = "";
  for (; a; a /= 10) r += a % 10 + '0';
  rev(r);
  return r;
}
const int N = 200005;
int a[N];
void solution() {
  long long n;
  read(n);
  long long c = 0;
  while (c * 10 + 9 <= n) {
    c = c * 10 + 9;
  }
  out(sum_num(c) + sum_num(n - c)) << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  solution();
  return 0;
}