def main(): N, Q = map(int, input().split()) condition = 0 for _ in range(Q): L, R = map(int, input().split()) condition = condition ^ (2**R - 2**(L-1)) # print(format(condition, "b").count("1")) if __name__ == "__main__": main()