#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair; const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55); #define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++) #define rep(i,n) FOR(i,0,n) template inline void chmax(T &x, U y) { if (x < y) x = y; } template inline void chmin(T &x, U y) { if (x > y) x = y; } ll dp[500000]; ll f(ll x) { if (x < 500000) { ll &r = dp[x]; if (r != -1) return r; } if (x == 0) return 1; return f(x / 3) + f(x / 5); } int main() { ll n; cin >> n; memset(dp, -1, sizeof(dp)); dp[0] = 1; FOR(i, 1, 500000) dp[i] = dp[i / 3] + dp[i / 5]; cout << f(n) << "\n"; return 0; }