// ※※※ 解答不能 ※※※ // https://yukicoder.me/submissions/197554 #include using namespace std; using LL = long long; #define repex(i, a, b, c) for(int i = a; i < b; i += c) #define repx(i, a, b) repex(i, a, b, 1) #define rep(i, n) repx(i, 0, n) #define repr(i, a, b) for(int i = a; i >= b; i--) LL n, a[1000009]; LL solve(LL x){ if(x <= 1000000) return a[x]; return solve(x / 3) + solve(x / 5); } int main(){ a[0] = 1; repx(i, 1, 1000001) a[i] = a[i / 3] + a[i / 5]; scanf("%lld", &n); printf("%lld\n", solve(n)); return 0; }