import java.io.*; import java.util.*; public class Main_yukicoder639 { private static Scanner sc; private static Printer pr; private static void solve() { long n = sc.nextLong(); hm = new HashMap<>(); hm.put(0L, 1L); pr.println(rec(n)); } private static long rec(long n) { if (hm.containsKey(n)) { return hm.get(n); } long ret = rec(n / 3) + rec(n / 5); hm.put(n, ret); return ret; } private static Map hm; // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }