def func(): strlist = list(map(str, input().split(','))) l = int(strlist[1]) r = int(strlist[-1]) print(r-l-1) if __name__ == "__main__": func()