P26866 [AtCoder] Gifts
NOI
题目描述

Problem Description

Score : $ 600 $ points

Penguin has a box containing $ N $ positive integers $A_1,\ A_2,\ldots,\ A_N$. He can perform the following operation on the box any number of times, including zero:

  • Choose any two elements from the box, allowing duplicates, and add their bitwise OR to the box. The chosen two integers remain in the box.

Penguin decided to give the box to kaage after repeating this operation.

Kaage loves seeing various kinds of integers, so he will be happier the more different integers are in the box.

By repeating the above operation, what is the maximum number of different integers Penguin can increase in the box?

Please refer to this link for the definition of bitwise OR.

Input Format

The input is given from the standard input in the following format:

\(N\)
\(A_1\) \(A_2\) \(\ldots\) \(A_N\)

Output Format

Output the maximum number of different integers that can be in the box eventually. Do not forget to add a newline at the end of the output.

Sample Input and Output

Sample Input #1

2
1 2

Sample Output #1

3

Sample Input #2

6
1 4 1 3 1 17

Sample Output #2

9

Sample Input #3

10
9321 547 38219 57491 212 8724 59243 8243 39842 982

Sample Output #3

89

Notes/Hints

None

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 1 2
样例输出
3