import java.io.*; import java.util.*; class Main { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); String s[]=bu.readLine().split(" "); int n=Integer.parseInt(s[0]),q=Integer.parseInt(s[1]); int ans=0,i; boolean t[]=new boolean[n]; while(q-->0) { s=bu.readLine().split(" "); int l=Integer.parseInt(s[0])-1,r=Integer.parseInt(s[1])-1; for(i=l;i<=r;i++) { t[i]=!t[i]; if(t[i]) ans++; else ans--; } sb.append(ans+"\n"); } System.out.print(sb); } }