package yukicoder; import java.util.*; public class P639 { static int memory = 100000000; static long[] memo = new long[memory]; public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); long n = sc.nextLong(); Arrays.fill(memo, -1); memo[0] = 1; System.out.println(a(n)); } static public long a(long n) { if(n==0) { return 1; } if(n<memory&&memo[(int)n]!=-1) { return memo[(int)n]; } if(n/3==n/5) { return 2*a(n/3); } return a(n/3)+a(n/5); } }