#coding:utf-8 N=input() T=(N//3+N//5)-(N//15) T_15=T/7 T_3_5=T-T_15 print T_15*4+T_3_5*2