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