rt
#include<bits/stdc++.h> using namespace std; int n,r,l; int main() { cin>>n>>l>>r; if((r-l)/n<1) cout<<r%n; else cout<<n-1; return 0; }