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(" ")
  
  	if input(2)>input(1)Then
    	Console.WriteLine("0")
  	Else
     	a=integer.parse(input(2))
     	b=integer.parse(input(1))
     	c=integer.parse(input(3))
    if b>c Then
     	ans= c-a
      	Console.WriteLine(ans)
  	Else
     	ans= b-a
      	Console.WriteLine(ans)
    End if    
  	End if	
    
    End Sub
End Module