QOJ.ac

QOJ

Límite de tiempo: 1.5 s Límite de memoria: 512 MB Puntuación total: 100

#3636. Brotherly numbers

Estadísticas

A set of numbers is called brotherly if there exists a number $p > 1$ such that $p$ divides all numbers in that set. Mr. Malnar received a permutation $P$ of numbers from $1$ to $n$ as a gift, which is a bit too long, so he will keep only the first few numbers of it.

Since Mr. Malnar loves brotherly sets, he is interested in how many non-empty brotherly subsets each prefix of the permutation $P$ contains. We all know that Mr. Malnar has more important work to do than counting subsets, so he has asked you to help him. Because these numbers are too large, he is only interested in the result modulo $998\,244\,353$.

Input

The first line contains a natural number $n$ ($1 \le n \le 3 \cdot 10^5$).

The next line contains $n$ numbers, where the $i$-th number is $P_i$, i.e., the $i$-th number of the permutation $P$.

Output

You need to print $n$ lines. In the $i$-th line, you need to print the remainder of the number of brotherly subsets in the prefix of length $i$ when divided by $998\,244\,353$.

Examples

Input 1

5
2 3 1 4 5

Output 1

1
2
2
4
5

Input 2

6
1 5 6 2 3 4

Output 2

0
1
2
4
6
10

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.