Module Module1
    Sub Main()
    Dim a as integer
  	Dim b as integer
  	Dim c as integer

  	Dim ans as integer
    Dim input() as string = Console.ReadLine().split(" ")
    
     	a=integer.parse(input(2))
     	b=integer.parse(input(1))
     	c=integer.parse(input(3))
    
     	if input(2)>input(1) Then
			ans=0
      　Elseif b>c Then 
     		ans= c-a
    	Elseif b<c Then
     		ans= b-a
    	End if
      	Console.WriteLine(ans)
    End Sub
End Module