ICM Technex 2017 and Codeforces Round 400 (Div. 1 + Div. 2, combined)
B
Sherlock and his girlfriend
Codeforces
1200
原题
← AC →
翻译中…

Sherlock has a new girlfriend (so unlike him!). Valentine's day is coming and he wants to gift her some jewelry.

翻译中…

He bought $*n*$ pieces of jewelry. The $*i*$-th piece has price equal to $*i* + 1$, that is, the prices of the jewelry are $2, 3, 4, ... *n* + 1$.

翻译中…

Watson gave Sherlock a challenge to color these jewelry pieces such that two pieces don't have the same color if the price of one piece is a prime divisor of the price of the other piece. Also, Watson asked him to minimize the number of different colors used.

翻译中…

Help Sherlock complete this trivial task.

翻译中…

Input

翻译中…

The only line contains single integer $*n*$ ($1 ≤ *n* ≤ 100000$) — the number of jewelry pieces.

翻译中…

Output

翻译中…

The first line of output should contain a single integer $*k*$, the minimum number of colors that can be used to color the pieces of jewelry with the given constraints.

翻译中…

The next line should consist of $*n*$ space-separated integers (between $1$ and $*k*$) that specify the color of each piece in the order of increasing price.

翻译中…

If there are multiple ways to color the pieces using $*k*$ colors, you can output any of them.

翻译中…

Note

翻译中…

In the first input, the colors for first, second and third pieces of jewelry having respective prices $2$, $3$ and $4$ are $1$, $1$ and $2$ respectively.

翻译中…

In this case, as $2$ is a prime divisor of $4$, colors of jewelry having prices $2$ and $4$ must be distinct.

翻译中…

样例

Input #1
3
Output #1
2
1 1 2
InputCopy OutputCopy
Input #2
4
Output #2
2
2 1 1 2
InputCopy OutputCopy
题目信息
题号
776B
时间限制
1 s
内存限制
256 MB
标签
构造
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。