201435: [AtCoder]ARC143 F - Counting Subsets

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $1200$ points

Problem Statement

Given a positive integer $N$, find the number, modulo $998244353$, of subsets $S$ of $\{1, 2, \ldots, N\}$ that satisfy the following condition.

  • Every positive integer at most $N$ can be represented as the sum of some distinct elements of $S$, and there are at most two such representations.

Constraints

  • $1 \leq N \leq 1500$

Input

Input is given from Standard Input in the following format:

$N$

Output

Print the answer.


Sample Input 1

3

Sample Output 1

2

The subsets $\{1,2\}$ and $\{1,2,3\}$ satisfy the condition.


Sample Input 2

5

Sample Output 2

5

Sample Input 3

1000

Sample Output 3

742952024

Input

加入题单

上一题 下一题 算法标签: