#include #include #include using namespace std; typedef long long LL; LL n; map mm; LL DFS(LL n) { if (n == 0) return 1; if (mm.count(n)) return mm[n]; LL x = DFS(n / 3) + DFS(n / 5); return mm[n] = x; } int main() { // freopen("seq.in", "r", stdin); // freopen("seq.out", "w", stdout); scanf("%lld", &n); printf("%lld\n", DFS(n)); return 0; }