#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); ll N; cin >> N; map mp; function dfs = [&](ll i) -> ll { if(i == 0) return 1LL; ll res = 0; for(ll x : {3, 5}) { if(mp.count(i / x)) res += mp[i / x]; else res += dfs(i / x); } return mp[i] = res; }; cout << dfs(N) << endl; }