PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000221. Bức tường và số nguyên tố (Red John is Back)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bức tường và số nguyên tố (Red John is Back)

Red John is Back

Source: HackerRank

Version: Phuoc Hung OJ Extended

Problem Statement

A wall consists of 44 rows and nn columns of unit cells. You have unlimited bricks of size 4×14\times1 and 1×41\times4, which may be placed vertically or horizontally to cover the wall without overlap or uncovered cells.

Let W(n)W(n) be the number of distinct complete tilings of the wall. Count prime numbers pp satisfying 2≤p≤W(n)2\le p\le W(n). Print the number of primes, not the number of tilings.

Input

The only line contains the integer nn, the length of the wall measured in unit-cell columns.

Output

Print a single integer: the number of primes not exceeding the tiling count W(n)W(n).

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le12.

  • Subtask 2 (30 points): 1≤n≤241\le n\le24.

  • Subtask 3 (50 points): 1≤n≤401\le n\le40.

Examples

Input

7

Output

3

Explanation

Lengths 11, 22 and 33 each have only one tiling, using vertical bricks. At length 44 there are two: four vertical bricks or four horizontal bricks. This gives W(5)=W(4)+W(1)=3W(5)=W(4)+W(1)=3, W(6)=W(5)+W(2)=4W(6)=W(5)+W(2)=4, and W(7)=W(6)+W(3)=5W(7)=W(6)+W(3)=5. The primes not exceeding 55 are 2,3,52,3,5, so the answer is 33.