#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; map memo; long long solve(long long i) { if(i == 0) return 1; else if(memo.find(i) != memo.end()) return memo[i]; else return memo[i] = solve(i/3) + solve(i/5); } int main() { long long n; cin >> n; cout << solve(n) << endl; return 0; }