40비트 선형 점화식이 만드는 수열의 처음 N개 값 가운데 짝수가 몇 개인지 센다.
어려움8수학동적 계획법비트 연산정수론아직 제출이 없습니다시간 제한0.3초메모리 제한512 MBDonald loves nature. Being a programmer, Donald writes programs to simulate the growth of trees or to build realistic 3D landscapes. For this purpose, Donald needs a good pseudo-random number generator. He devises the following method to produce an infinite sequence of 40-bit unsigned integers (the lines in green are comments).
On the last line, x >> 20 denotes the quotient of the Euclidean division of x by 220 and x % M denotes the remainder of the Euclidean division of x by M.
As a very first test to decide if this is indeed a good pseudo-random number generator, Donald wishes to count the number of even values produced by this sequence, in order to check whether this is close enough to 50%. Your help will be welcome.
The input consists of a single line, containing an integer N.
The output should contain a single line with a single integer corresponding to the number of even values in the sequence S(0), S(1), . . . , S(N − 1).
The input satisfies 0 ≤ N < 263.