#include <bits/stdc++.h>
using namespace std;
int gcd(int n1, int n2) { return (n2 == 0) ? n1 : gcd(n2, n1 % n2); }
int main() {
  int n;
  cin >> n;
  vector<bool> v(n + 1, true);
  int counter = n - 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 2; j < i && i * j <= n; j++) {
      if (i * j / gcd(i, j) != max(i, j) && v[i * j / gcd(i, j)]) {
        v[i * j / gcd(i, j)] = false;
        counter--;
      }
    }
  }
  cout << counter << endl;
  for (int i = 2; i <= n; i++) {
    if (i == 2)
      cout << 2;
    else if (v[i])
      cout << ' ' << i;
  }
  cout << endl;
  return 0;
}
