nums = list(input().split(','))

s = int(nums[1])
e = int(nums[-1])

print(e - s - 1)