X,Y=map(int,input().split())
M =(X+4)%12+(X+8)%12-X
M+=(Y+4)%12+(Y+8)%12-Y
print(M//2)