Great Party

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Grammy joined a great party.

There is an interesting game at the party. There are nn piles of stones on the table. The ii-th pile has a_ia\_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:

  1. Select a non-empty pile of stones, select a positive amount of stones to remove from it.
  2. Keep the remaining stones in the pile still or merge them all into another non-empty pile of stones.

Those who cannot operate lose the game.

Now, Grammy has qq questions. For each question, she asks you how many sub-segments of \[l,r]\[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 nn and qq (1n,q1051 \leq n, q \leq 10^5).

The second line contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (1a_i1061 \leq a\_i \leq 10^6).

The ii-th of the next qq lines contains two integers l_il\_i and r_ir\_i (1l_ir_in1 \leq l\_i \leq r\_i \leq n).

출력

The output contains qq lines. Each line contains a single integer, denoting the answer to the question.