#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e6 + 5;
const long long inf = 1e10;
const long long mod = 1e9 + 7;
long long n;
long long ans = 1;
long long res[maxN];
void normalSieve(long long n) {
  for (long long i = 1; i <= n; i++) res[i] = 1;
  for (long long i = 2; i * i <= n; i++) {
    if (res[i] == 1) {
      for (long long j = i * i; j <= n; j += i) {
        res[j] = 2;
        ans = 2;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  normalSieve(n + 1);
  cout << ans << endl;
  for (long long i = 2; i <= n + 1; i++) cout << res[i] << " ";
  return 0;
}
