import sys str1 = list(sys.stdin.readline().strip().split(',')) print(int(str1[-1]) - int(str1[-3]) - 1)