#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; map dp; auto rec = [&](auto self, ll v) -> ll { if(v == 0) return 1; if(dp.find(v) != dp.end()) return dp[v]; return dp[v] = self(self, v / 3) + self(self, v / 5); }; cout << rec(rec, n) << '\n'; }