#include using namespace std; typedef long long ll; const int INF = 1000000100; const ll INFL = 2e18; template bool chmin(T &a, T b){ if (a > b) { a = b; return true;} else return false;} template bool chmax(T &a, T b){ if (a < b) { a = b; return true;} else return false;} int main() { int N; cin >> N; int Q; cin >> Q; vector Lamp(N,0); int now = 0; for (int i = 0;i < Q;i++) { int L,R; cin >> L >> R; L--,R--; for (int j = L;j <= R;j++) { if (Lamp[j]) { now--; Lamp[j] = 0; } else { now++; Lamp[j] = 1; } } cout << now << endl; } }