#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma G++ optimize("O3")
using namespace std;
const double PI = acos(-1.0);
const int MAXN = 2e6 + 55;
const int INF = 0x3f3f3f3f;
const int NINF = 0x80808080;
const long long NLINF = 0x8080808080808080;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long mo = 1e9 + 7;
inline long long fpow(long long a, long long b) {
  long long s = 1;
  a %= mo;
  while (b) {
    if (b & 1) s = s * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return s;
}
namespace Fast_IO {
const int MAXL((1 << 18) + 1);
int iof, iotp;
char ioif[MAXL], *ioiS, *ioiT, ioof[MAXL],
    *iooS = ioof, *iooT = ioof + MAXL - 1, ioc, iost[55];
inline char Getchar() {
  if (ioiS == ioiT) {
    ioiS = ioif;
    ioiT = ioiS + fread(ioif, 1, MAXL, stdin);
    return (ioiS == ioiT ? EOF : *ioiS++);
  } else
    return (*ioiS++);
}
inline int read() {
  int x = 0;
  for (iof = 1, ioc = Getchar(); (ioc < '0' || ioc > '9') && ioc != EOF;)
    iof = ioc == '-' ? -1 : 1, ioc = Getchar();
  if (ioc == EOF) exit(0);
  for (x = 0; ioc <= '9' && ioc >= '0'; ioc = Getchar())
    x = (x << 3) + (x << 1) + (ioc ^ 48);
  return x * iof;
}
inline long long read_ll() {
  long long x = 0;
  for (iof = 1, ioc = Getchar(); (ioc < '0' || ioc > '9') && ioc != EOF;)
    iof = ioc == '-' ? -1 : 1, ioc = Getchar();
  if (ioc == EOF) exit(0);
  for (x = 0; ioc <= '9' && ioc >= '0'; ioc = Getchar())
    x = (x << 3) + (x << 1) + (ioc ^ 48);
  return x * iof;
}
}  // namespace Fast_IO
using namespace Fast_IO;
int n;
long long ans;
char s[55];
long long dp[55][10];
long long dfs(int wei, int now) {
  if (wei > n) return 1;
  if (dp[wei][now] != -1) return dp[wei][now];
  int num = (s[wei] - '0') + now;
  return dp[wei][now] = dfs(wei + 1, num >> 1) +
                        (num & 1 ? dfs(wei + 1, (num + 1) >> 1) : 0);
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  if (n == 1)
    printf("9");
  else {
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i <= 9; i++) ans += dfs(2, i);
    for (int i = 2; i <= n; i++) {
      if (abs(s[i] - s[i - 1]) > 1)
        break;
      else if (i == n)
        ans--;
    }
    printf("%lld", ans);
  }
  return 0;
}
