AT_aalc001_j 長い 01 列

Description

There is a string $ S $ of length $ 10^{18} $ consisting of `0` and `1`. Let $ S_i $ denote the $ i $ -th character of $ S $ . Initially, all characters of $ S $ are `0`. Process $ Q $ queries. Each query is of one of the following $ 2 $ types: - `1 l r`: Flip $ S_l,S_{l+1},\ldots,S_r $ . That is, change each `0` to `1` and each `1` to `0`. - `2 l r`: Print the number of `1`s among $ S_l,S_{l+1},\ldots,S_r $ .

Input Format

The input is given from Standard Input in the following format: > $ Q $ $ \mathrm{query}_1 $ $ \mathrm{query}_2 $ $ \vdots $ $ \mathrm{query}_Q $ Each query is given in one of the following formats: > $ 1 $ $ l $ $ r $ > $ 2 $ $ l $ $ r $

Output Format

Let $ q $ be the number of type $ 2 $ queries. Print $ q $ lines. The $ j $ -th line should contain the answer to the $ j $ -th type $ 2 $ query.

Explanation/Hint

### Sample Explanation 1 Initially, all characters of $ S $ are `0`. After processing query $ 2 $ , the characters that are `1` are $ S_3,S_4,S_5,S_6,S_7 $ . After processing query $ 4 $ , the characters that are `1` are $ S_3,S_4,S_8,S_9,S_{10},S_{11},S_{12} $ . ### Constraints - $ 1 \leq Q \leq 2 \times 10^5 $ - $ 1 \leq l \leq r \leq 10^{18} $ - All numerical values in the input are integers.