package main import . "fmt" import . "os" import bf "bufio" func main() { rd:=bf.NewReader(Stdin) var n,q int Fscan(rd,&n,&q) a:=make([]int,n+1) x:=0 for ;q>0;q-- { var li,ri int Fscan(rd,&li,&ri) for i:=li;i<=ri;i++ { a[i]=1-a[i] x+=2*a[i]-1 } Println(x) } }