func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, pos, l, r;     cin >> n >> pos >> l >> r;     int result;     if (l == 1 && r == n) {       result = 0;     } else if (l == 1) {       result = abs(pos - r) + 1;     } else if (r == n) {       result = abs(pos - l) + 1;     } else {       result = min(abs(pos - l), abs(pos - r)) + r - l + 2;     }     cout << result << endl;   }   