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

#SP0000050. Sherlock và bạn gái (Sherlock and His Girlfriend)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Sherlock và bạn gái (Sherlock and His Girlfriend)

Sherlock and His Girlfriend

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Sherlock has nn pieces of jewelry indexed from 11 to nn, with respective prices 2,3,…,n+12,3,\ldots,n+1. Color them so that two pieces use different colors whenever the price of one is a prime divisor of the price of the other. Minimize the number of distinct colors. Any optimal coloring is acceptable.

Input

One line containing the integer nn.

Output

The first line contains the minimum number of colors kk. The second line has exactly nn integers c1,…,cnc_1,\ldots,c_n, with 1≤ci≤k1\le c_i\le k, where cic_i is the color for price i+1i+1.

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le 20.
  • Subtask 2 (30 points): 1≤n≤10001\le n\le 1000.
  • Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000.

Examples

Input

3

Output

2
1 1 2

Explanation

There are three prices, 2,3,42,3,4. Since 22 is a prime divisor of 44, those prices must have different colors. Assign color 11 to prices 2,32,3 and color 22 to price 44. One color is impossible, so two colors are optimal.