x, y = map(int, input().split()) print(0 if x==y==0 else 1 if abs(x)==abs(y) or x==0 or y==0 else 2)