#1187. 3.lowbit 求和

3.lowbit 求和

当前没有测试数据。

3.lowbit 求和

题目描述

给定数列AA,求下式的值:

$$\sum_{i=1}^{n}\sum_{j=1}^{n}\text{lowbit}(A_i \oplus A_j) $$

其中,lowbit(x)=x and (x)\text{lowbit}(x) = x \ \text{and} \ (-x)

输入格式

第一行一个整数nn

接下来一行nn个整数,表示数列AA

输出格式

一个整数表示答案,由于答案很大,请你输出答案对199907210507199907210507取模后的值。

数据范围与提示

对于100%100\%的数据,1<n<1000001 < n < 1000000Ai26010 \leq A_i \leq 2^{60} - 1

本题采用子任务捆绑测试。对于每个子任务,你只有通过了这个子任务的所有数据,才能获得这个子任务的分数。

  • 子任务112020分):1<n<1001 < n < 1000Ai26010 \leq A_i \leq 2^{60} - 1
  • 子任务222020分):1<n<1000001 < n < 1000000Ai21010 \leq A_i \leq 2^{10} - 1
  • 子任务336060分):无特殊限制。

样例

5
1 2 3 4 5
32