#include <bits/stdc++.h>
using namespace std;
int n, x, y, num[10], i, j, vis[10];
int check(int a, int b) {
  int i, d, tmp;
  for (i = 0; i <= 9; i++) {
    vis[i] = 0;
  }
  tmp = num[a];
  while (tmp != 0) {
    d = tmp % 10;
    if (!vis[d]) {
      vis[d] = 1;
    }
    tmp /= 10;
  }
  tmp = num[b];
  while (tmp != 0) {
    d = tmp % 10;
    if (!vis[d]) {
      break;
    }
    tmp /= 10;
  }
  return (!tmp);
}
int ans = 0;
int main() {
  cin >> n;
  num[0] = 123456;
  num[1] = 34;
  num[2] = 23567;
  num[3] = 23457;
  num[4] = 1347;
  num[5] = 12457;
  num[6] = 124567;
  num[7] = 234;
  num[8] = 1234567;
  num[9] = 123457;
  if (n < 10) {
    x = 0;
    y = n;
  } else {
    x = n / 10;
    y = n % 10;
  }
  for (i = 0; i <= 9; i++) {
    for (j = 0; j <= 9; j++) {
      if (check(i, x) && check(j, y)) {
        ans++;
      }
    }
  }
  cout << ans;
  return 0;
}
