#include <bits/stdc++.h>
using namespace std;
vector<long long> SieveOfEratosthenes(long long n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  vector<long long> v;
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long i = 2; i <= n; i++) {
    if (prime[i]) v.push_back(i);
  }
  return v;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> v = SieveOfEratosthenes(n + 1);
  long long a[n + 2];
  for (long long i = 0; i < n + 2; i++) a[i] = 0;
  for (long long i = 0; i < v.size(); i++) a[v[i]] = 1;
  for (long long i = 2; i < n + 2; i++) {
    if (a[i] == 0) a[i] = 2;
  }
  if (n > 2)
    cout << 2 << "\n";
  else
    cout << 1 << "\n";
  for (long long i = 2; i < n + 2; i++) cout << a[i] << " ";
  return 0;
}
