#用,分隔输入
s=input().split(',')
temp=int(s[3])-int(s[1])
ans=temp-1
print(ans)

7-3=4表明7到3之间差4段为长为1的间距

所以要减去3到4的间距才能得到路径点的数量