#include using namespace std; typedef long long int ll; int main(){ int n,q; cin >> n >> q; vector v(n, false); int ans = 0; while(q--){ int l,r; cin >> l >> r; l--; r--; int before = 0, after = 0; for(int i = l;i <= r;i++){ if(v[i]){ before++; } v[i] = not(v[i]); if(v[i]){ after++; } } ans -= before; ans += after; cout << ans << "\n"; } return 0; }