a,b=map(int,input().split()) nowa= ((a*60*60)+(b*60)) * (360/43200) nowb= b * 360/60 sa=abs(nowa-nowb) if nowa%360==nowb%360:print(0) else:print(int(sa / (360/3600 - 360/43200)))