A=[(2, 2, 2), (2, 7, 3), (7, 2, 3), (2, 23, 5), (23, 2, 5), (2, 47, 7), (47, 2, 7), (2, 167, 13), (167, 2, 13), (2, 359, 19), (359, 2, 19), (2, 839, 29), (839, 2, 29), (2, 1367, 37), (1367, 2, 37), (2, 1847, 43), (1847, 2, 43), (2, 2207, 47), (2207, 2, 47), (2, 3719, 61), (3719, 2, 61), (2, 5039, 71), (5039, 2, 71), (2, 7919, 89), (7919, 2, 89), (2, 10607, 103), (10607, 2, 103), (2, 11447, 107), (11447, 2, 107), (2, 16127, 127), (16127, 2, 127), (2, 17159, 131), (17159, 2, 131), (2, 19319, 139), (19319, 2, 139), (2, 29927, 173), (29927, 2, 173), (2, 36479, 191), (36479, 2, 191), (2, 44519, 211), (44519, 2, 211), (2, 49727, 223), (49727, 2, 223), (2, 54287, 233), (54287, 2, 233), (2, 57119, 239), (57119, 2, 239), (2, 66047, 257), (66047, 2, 257), (2, 85847, 293), (85847, 2, 293), (2, 97967, 313), (97967, 2, 313), (2, 113567, 337), (113567, 2, 337), (2, 128879, 359), (128879, 2, 359), (2, 177239, 421), (177239, 2, 421), (2, 196247, 443), (196247, 2, 443), (2, 201599, 449), (201599, 2, 449), (2, 218087, 467), (218087, 2, 467), (2, 241079, 491), (241079, 2, 491), (2, 273527, 523), (273527, 2, 523), (2, 292679, 541), (292679, 2, 541), (2, 323759, 569), (323759, 2, 569), (2, 344567, 587), (344567, 2, 587), (2, 368447, 607), (368447, 2, 607), (2, 426407, 653), (426407, 2, 653), (2, 458327, 677), (458327, 2, 677)] N=int(input()) ANS=0 for x,y,r in A: if x<=N and y<=N and r<=N: ANS+=1 print(ANS)