#include <bits/stdc++.h>
int n, m, ans, target, len, f[18003005], p[18003005 / 10];
int main() {
  scanf("%d", &n), m = (n + 1) * n / 2;
  if (n == 2) {
    printf("1 1\n");
    return 0;
  }
  for (int i = 2; i <= m; i++) {
    if (!f[i]) f[i] = i, p[++len] = i;
    for (int j = 1; j <= len && p[j] <= f[i] && p[j] * i <= m; j++)
      f[p[j] * i] = p[j];
  }
  for (int i = 1; i <= n && !ans; i++)
    if (f[i] == i && f[m - i] == m - i) ans = i;
  for (int i = 1; i <= n && !ans; i++)
    for (int j = i + 1; j <= n && !ans; j++)
      if (f[i] == i && f[j] == j && f[m - i - j] == m - i - j)
        ans = i, target = j;
  for (int i = 1; i <= n; i++)
    printf("%d%s", 1 + (ans == i) + (target == i) * 2, i < n ? " " : "\n");
  return 0;
}
