sgu105

maksyuki 发表于 oj 分类,标签:
0
  1. Div 3

There is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine amount of numbers in it that are divisible by 3.

Input

Input contains N (1<=N<=231 - 1).

Output

Write answer to the output.

Sample Input

4

Sample Output

2

 

题目类型:简单数学

算法分析:打表发现各位和能整除3的数是有规律的,直接按照规律求解即可(任意数模3的取值只有0、1和2)