#include #include using lint = long long; lint dfs(lint n) { static std::map dp; if (dp.count(n)) return dp[n]; auto& ret = dp[n]; if (n == 0) return ret = 1; return ret = dfs(n / 3) + dfs(n / 5); } void solve() { lint n; std::cin >> n; std::cout << dfs(n) << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }