CF449D.Jzzhu and Numbers

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Jzzhu have n non-negative integers _a_1, _a_2, ..., a__n. We will call a sequence of indexes _i_1, _i_2, ..., i__k (1 ≤ _i_1 < _i_2 < ... < i__k ≤ n) a group of size k.

Jzzhu wonders, how many groups exists such that _a__i_1 & _a__i_2 & ... & a__i__k = 0 (1 ≤ k ≤ n)? Help him and print this number modulo 1000000007 (109 + 7). Operation x & y denotes bitwise AND operation of two numbers.

Jzzhu 有 nn 个非负整数 a1,a2,…,ana_1, a_2, \dots, a_n。我们将满足 1≤i1<i2<⋯<ik≤n1 \le i_1 < i_2 < \dots < i_k \le n 的下标序列 i1,i2,…,iki_1, i_2, \dots, i_k 称为一个大小为 kk 的组。

Jzzhu 想知道:满足 ai1&ai2&…&aik=0a_{i_1} \& a_{i_2} \& \dots \& a_{i_k} = 0(其中 1≤k≤n1 \le k \le n)的组共有多少个?请你帮他计算,并将结果对 10000000071000000007(即 109+710^9 + 7)取模后输出。运算符 x&yx \& y 表示两个数的按位与(bitwise AND)运算。

输入格式

The first line contains a single integer n (1 ≤ n ≤ 106). The second line contains n integers _a_1, _a_2, ..., a__n (0 ≤ a__i ≤ 106).

第一行包含一个整数 nn(1≤n≤1061 \leq n \leq 10^6)。第二行包含 nn 个整数 a1,a2,…,ana_1, a_2, \dots, a_n(0≤ai≤1060 \leq a_i \leq 10^6)。

输出格式

Output a single integer representing the number of required groups modulo 1000000007 (109 + 7).

输出一个整数,表示所需组数对 1000000007(即 109+710^9 + 7)取模的结果。

输入输出样例

  • 输入#1

    3
    2 3 3

    输出#1

    0
  • 输入#2

    4
    0 1 2 3

    输出#2

    10
  • 输入#3

    6
    5 2 0 5 2 1

    输出#3

    53

输入解题思路,AI测评打分。不知道怎么写?

首页