CF922B.Magic Forest

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Imp is in a magic forest, where xorangles grow (wut?)

A xorangle of order nn is such a non-degenerate triangle, that lengths of its sides are integers not exceeding nn , and the xor-sum of the lengths is equal to zero. Imp has to count the number of distinct xorangles of order nn to get out of the forest.

Formally, for a given integer nn you have to find the number of such triples (a,b,c)(a,b,c) , that:

  • 1<=a<=b<=c<=n1<=a<=b<=c<=n ;
  • , where denotes the bitwise xor of integers xx and yy .
  • (a,b,c)(a,b,c) form a non-degenerate (with strictly positive area) triangle.

输入格式

The only line contains a single integer nn (1<=n<=2500)(1<=n<=2500) .

输出格式

Print the number of xorangles of order nn .

输入输出样例

  • 输入#1

    6
    

    输出#1

    1
    
  • 输入#2

    10
    

    输出#2

    2
    

说明/提示

The only xorangle in the first sample is (3,5,6)(3,5,6) .

首页