#include <iostream> using namespace std; int main(){ int n, l, r; cin >> n >> l >> r; int max = 0; if(r - l >= n) { cout << n - 1 << endl; }else{ while(l <= r) { if(l % n > max) { max = l % n; } l++; } cout << max << endl; } return 0; }