Grammy joined a great party.
There is an interesting game at the party. There are n piles of stones on the table. The i-th pile has a_i stones in it. Two players participate in the game and operate the stones in turn.
In each player's turn, the player will do the following two steps:
Those who cannot operate lose the game.
Now, Grammy has q questions. For each question, she asks you how many sub-segments of \[l,r] satisfy that if the piles in the segment are taken out alone for the game, the first player will win.
The first line contains two integers n and q (1≤n,q≤105).
The second line contains n integers a_1,a_2,…,a_n (1≤a_i≤106).
The i-th of the next q lines contains two integers l_i and r_i (1≤l_i≤r_i≤n).
The output contains q lines. Each line contains a single integer, denoting the answer to the question.