func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 1e9 + 7;   const int MN = 1e6 + 6;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(10);     long long n;     cin >> n;     long long p_x = 0, p_y = 0;     long long res = 1;     for (long long i = 0; i < n; ++i) {       long long n_x, n_y;       cin >> n_x >> n_y;       if (p_x == n_x && p_y == n_y) continue;       long long a = max(p_x, p_y);       long long b = min(n_x, n_y);       if (p_x == p_y) {         a++;       }       if (a <= b) res += b - a + 1;       p_x = n_x;       p_y = n_y;     }     cout << res << endl;     return 0;   }   