trip_date=input() date=[int(i) for i in trip_date.split(" ")] vacation=range(date[0],date[1]+1) vacation_set=set(vacation) gassyuku_set={23,24,25} print(3-len(vacation_set & gassyuku_set))