logo AlgoBeat OnlineJudge
登录 注册

#215130. [ICPC 2024 Chengdu R] Expanding Array

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

题目描述

Given an integer array of length , you can perform any number of operations on this array. In each operation, you can choose two adjacent elements and (), and insert one of the following three values between them: , , or . Your task is to determine the maximum number of distinct values that can exist in the array after performing any number of operations.

represents the bitwise AND of and . represents the bitwise OR of and . represents the bitwise XOR (exclusive OR) of and .

输入格式

The first line contains a single integer (), representing the length of the array.

The second line contains integers (), representing the elements of the array.

输出格式

Output a single integer, representing the maximum number of distinct values that can be obtained in the array after performing any number of operations.

样例

样例输入 1

2
2 3

样例输出 1

4

样例输入 2

2
3 4

样例输出 2

4