#include #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair; int main() { int n; cin >> n; if (n < 6) { if (n == 1) cout << 1 << endl; if (n == 2) cout << 1 << endl; if (n == 3) cout << -1 << endl; if (n == 4) cout << 2 << " " << 4 << endl; if (n == 5) cout << -1 << endl; return 0; } vector a, b, c; for (int i = 1; i <= n; i++) { if (i % 2 == 0 && i % 3 == 0) c.push_back(i); else if (i % 2 == 0) a.push_back(i); else if (i % 3 == 0) b.push_back(i); } int m = (n + 1) / 2; rep(i, m) { if (!a.empty()) { cout << a.back() << " "; a.pop_back(); } else if (!c.empty()) { cout << c.back() << " "; c.pop_back(); } else { cout << b.back() << " "; b.pop_back(); } } cout << endl; return 0; }