#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ int N, Q, l, r, ans=0; cin >> N >> Q; deque on(N+1); for (int i=0; i> l >> r; for (int j=l; j<=r; j++){ if (on[j]) ans--; else ans++; on[j] ^= 1; } cout << ans << endl; } return 0; }