#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, size;
  cin >> n;
  if (n <= 2) {
    cout << 1 << "\n";
  } else {
    cout << 2 << "\n";
  }
  long long orign = n;
  n++;
  if (n % 2 == 0) {
    size = (n) / 2;
  } else {
    size = (n + 1) / 2;
  }
  vector<bool> is_prime(size, true);
  is_prime[0] = false;
  for (i = 1; (((2 * i) + 1) * ((2 * i) + 1)) <= n; i++) {
    if (is_prime[i]) {
      for (j = (((2 * i) + 1) * ((2 * i) + 1)); j <= n; j += ((2 * i) + 1)) {
        if ((j - 1) % 2 == 0) {
          is_prime[(j - 1) / 2] = false;
        }
      }
    }
  }
  vector<long long> arr(orign + 2, 0);
  arr[0] = -1;
  arr[1] = -1;
  arr[2] = 1;
  for (i = 1; i < size; i++) {
    if (is_prime[i]) {
      arr[(2 * i) + 1] = 1;
    }
  }
  for (i = 0; i < orign + 2; i++) {
    if (arr[i] == 0) {
      arr[i] = 2;
    }
  }
  for (i = 2; i < orign + 2; i++) {
    cout << arr[i] << " ";
  }
  cout << "\n";
  return 0;
}
