lst=[x for x in input().split(',')]
temp=lst.index('...')
b=int(lst[temp+1])-int(lst[temp-1])-1
print(b)