#include using namespace std; typedef long long ll; #define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i) templatebool chmin(T&a,const T&b){return a>b?(a=b,true):false;} templatebool chmax(T&a,const T&b){return a N) ans = 0; else if (K == N + 1 - K) { ans = N - 1; } else { ans = N - 2; } cout << ans << endl; return 0; } int main() { for (;!cin.eof();cin>>ws) main2(); return 0; }