s = list(map(str, input().strip().split(',')))
print(int(s[3]) - int(s[1])-1)