#include<bits/stdc++.h> using namespace std; int main() { int n,R,L,maxn; cin>>n>>L>>R; while(R>L) { maxn = max(maxn,R%n); R--; // cout<<R<<" "; } cout<<maxn; return 0; }