ints = list(map(int, input().split())) print(max((ints[1] - ints[0], ints[2] - ints[1]))-1)