#include <bits/stdc++.h>
using namespace std;
int nums[1001000];
int main(void) {
  int n;
  cin >> n;
  n++;
  for (int i = 2; i <= n; i++) {
    nums[i] = 1;
  }
  for (int i = 2; i <= n; i++) {
    if (nums[i] == 1) {
      for (int j = i + i; j <= n; j += i) {
        nums[j] = 2;
      }
    }
  }
  if (n > 3) {
    cout << 2 << endl;
  } else {
    cout << 1 << endl;
  }
  for (int i = 2; i <= n; i++) {
    cout << nums[i] << " ";
  }
  cout << endl;
}
