atcoder#ARC143F. [ARC143F] Counting Subsets

[ARC143F] Counting Subsets

Score : 12001200 points

Problem Statement

Given a positive integer NN, find the number, modulo 998244353998244353, of subsets SS of {1,2,,N}\{1, 2, \ldots, N\} that satisfy the following condition.

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

Constraints

  • 1N15001 \leq N \leq 1500

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer.

3
2

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

5
5
1000
742952024