#include #include #include #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define repR(i, n) for(int i = (n) - 1; i > -1; i--) #define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++) #define rep1R(i, n) for(int i = (n); i > 0; i--) #define ll long long using namespace std; ll N; static const int k = 1000000; ll dp[k + 1] = {}; void init() { dp[0] = 1; rep1(i, k) { dp[i] = dp[i / 3] + dp[i / 5]; } } ll a(ll n) { if (dp[0] == 0) init(); if (n <= k) return dp[n]; else return a(n / 3) + a(n / 5); } int main() { cin >> N; cout << a(N) << endl; return 0; }