import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] cnt = new int[N]; int Q = sc.nextInt(); int ans = 0; for( int i = 0; i < Q; i++ ) { int L = sc.nextInt()-1; int R = sc.nextInt()-1; for( int j = L; j <= R; j++ ) { cnt[j]++; if( cnt[j]%2 == 0 ) ans--; else ans++; } System.out.println(ans); } sc.close(); } }