#include <bits/stdc++.h>
using namespace std;
void sieve(int n, bool a[]) {
  a[0] = false;
  a[1] = false;
  for (int i = 2; i * i <= n; ++i) {
    if (a[i]) {
      for (int j = i * i; j <= n; j += i) {
        a[j] = false;
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  if (n <= 2) {
    cout << 1 << endl;
    for (int i = 0; i < n; ++i) {
      cout << 1 << " ";
    }
    cout << endl;
  } else {
    bool p[n + 2];
    memset(p, true, (n + 2) * sizeof(bool));
    sieve(n + 1, p);
    cout << 2 << endl;
    for (int i = 2; i <= n + 1; ++i) {
      if (p[i]) {
        cout << 1 << " ";
      } else {
        cout << 2 << " ";
      }
    }
    cout << endl;
  }
}
