#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int a[n + 2], cnt = n - 1;
  for (int i = 2; i <= n; i++) {
    a[i] = i;
  }
  for (int i = 2; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (a[j] == 0) continue;
      if (i * j <= n && j % i != 0) {
        a[i * j] = 0;
        cnt--;
      }
    }
  }
  cnt = 0;
  for (int i = 2; i <= n; i++) {
    if (a[i] != 0) {
      cnt++;
    }
  }
  cout << cnt << endl;
  for (int i = 2; i <= n; i++) {
    if (a[i] != 0) {
      cout << a[i] << " ";
    }
  }
  printf("\n");
  return 0;
}
