logo AlgoBeat OnlineJudge
登录 注册

#215665. [ICPC 2021 Jakarta R] XOR Pairs

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

XOR is a bitwise operator that evaluates the resulting bit into 1 if and only if their corresponding input bits differ (one of them is 1 while the other is 0). XOR operator is usually written with a symbol , or in most programming languages, the character ^ (caret). For example, .

In this problem, you are given an integer and a set of integers . Your task is to count how many pairs of integers such that , and .

For example, let and . There are 6 pairs of that satisfy the condition.

Observe that a pair such as does not satisfy the condition for this example as but . Another pair such as also does not satisfy the condition as it violates the requirement .

输入格式

Input begins with a line containing two integers (; ) representing the given and the size of the set of integers . The next line contains integers () representing the set of integers .

输出格式

Output contains an integer in a line representing the number of such that and .

样例

样例输入 1

10 4
4 6 7 10

样例输出 1

6

样例输入 2

8 5
4 3 5 8 1

样例输出 2

10

样例输入 3

20 7
3 7 18 15 12 18 19

样例输出 3

50

样例输入 4

5 6
1 2 3 4 5 6

样例输出 4

0

数据范围与提示

Explanation for the sample input/output #1

This is the example from the problem description.

Explanation for the sample input/output #2

There are 10 pairs of that satisfy the condition.