P26690 [AtCoder] Equiangular
提高-
题目描述

Problem Description

You have a regular $ N $-sided convex polygon. You are going to choose $ 3 $ or more vertices from the polygon, and make a new convex polygon $ P $ formed by chosen vertices. You very much like equiangular polygons (polygons whose vertex angles are all equal), so the polygon $ P $ must be equiangular.

Count the number of equiangular polygons that you can get in the above-mentioned way. Here, two polygons are considered to be the same if they are congruent, that is, one has the same shape and size as the other or as the mirror image of the other.

Input Format

Input is given from Standard Input in the following format:

$ N $

Output Format

Print the number of equiangular polygons that you can get.

Sample Input and Output

Sample Input #1

6

Sample Output #1

3

Sample Input #2

10

Sample Output #2

4

Sample Input #3

1000000000000

Sample Output #3

749847411091

Notes/Hints

Constraints

  • $3\ \leq\ N\ \leq\ 10^{12}$

Sample Explanation 1

You can get following $ 3 $ polygons. [MATH0]

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6
样例输出
3