CF1609F.Interesting Sections
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
William has an array of non-negative numbers a1,a2,…,an . He wants you to find out how many segments l≤r pass the check. The check is performed in the following manner:
- The minimum and maximum numbers are found on the segment of the array starting at l and ending at r .
- The check is considered to be passed if the binary representation of the minimum and maximum numbers have the same number of bits equal to 1.
输入格式
The first line contains a single integer n ( 1≤n≤106 ), the size of array a .
The second line contains n integers a1,a2,…,an ( 0≤ai≤1018 ), the contents of array a .
输出格式
Output a single number — the total number of segments that passed the check.
输入输出样例
输入#1
5 1 2 3 4 5
输出#1
9
输入#2
10 0 5 7 3 9 10 1 6 13 7
输出#2
18