Gx,Gy=map(int,input().split()) if Gx==Gy==0:print(0) elif Gx==Gy:print(1) else:print(2)