#include using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; template using V = vector; template using VV = V>; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); } #define rep(i,N) for(int i=0;i<(int)(N);i++) #define rep1(i,N) for(int i=1;i<=(int)(N);i++) #define fs first #define sc second #define pb push_back #define PB push_back #define MP make_pair #define show(x) cerr << #x << " = " << (x) << endl #define FOR(i, a, b) for(int i=int(a);i void chmin(T& t, const U& u) { if (t > u) t = u; } template void chmax(T& t, const U& u) { if (t < u) t = u; } template struct MaxClique { using B = bitset; int n; V g, col_buf; V clique, now; struct P { int id, col, deg; }; void coloring(V

& v) { int m = int(v.size()); sort(v.begin(), v.end(), [&](P a, P b) { return a.deg > b.deg; }); for (int i = 0; i < m; i++) { v[i].col = 0; while ((g[v[i].id] & col_buf[v[i].col]).any()) v[i].col++; col_buf[v[i].col].set(v[i].id); } for (int i = 0; i < n; i++) col_buf[i].reset(); sort(v.begin(), v.end(), [&](P a, P b) { return a.col < b.col; }); } ll gc = 0, gc2 = 0; void dfs(V

rem) { if (clique.size() < now.size()) { cerr << "REF: " << now.size() << endl; clique = now; } gc2++; if (gc2 % 10000 == 0) { cerr << "gc2 : " << gc2 << endl; } while (!rem.empty()) { auto p = rem.back(); int i = p.id; if (now.size() + p.col + 1 <= clique.size()) break; gc++; if (gc % 10000 == 0) { cerr << "gc : " << gc << endl; } V

nrem; B bs = B(); for (auto q: rem) { if (g[i][q.id]) { nrem.push_back({q.id, -1, 0}); bs.set(q.id); } } for (auto& q: nrem) { q.deg = (bs & g[q.id]).count(); } coloring(nrem); now.push_back(i); dfs(nrem); now.pop_back(); rem.pop_back(); } } MaxClique(VV _g) : n(int(_g.size())), col_buf(n) { g = V(n); V

rem; for (int i = 0; i < n; i++) { rem.push_back({i, -1, int(_g[i].size())}); for (auto e: _g[i]) g[i][e.to] = 1; } coloring(rem); dfs(rem); } }; ll nex(ll S) { return (S * 12345) % 1000003; } int main() { struct E { int to; }; cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(20) << fixed; ll S; cin >> S; S = nex(S); int n = (S % 120) + 2; VV g(n); S = nex(S); ll P = S; for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { S = nex(S); if (S < P) { g[i].push_back({j}); g[j].push_back({i}); } } } auto st = MaxClique<123, E>(g).clique; int k = int(st.size()); cout << k + 1 << endl; for (int i = 0; i < k; i++) { cout << st[i] + 1 << (i == k - 1 ? '\n' : ' '); } return 0; } /* int main() { int n, m; cin >> n >> m; VV mp(n, V(n, 1)); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; mp[a][b] = mp[b][a] = 0; } struct E { int to; }; VV g(n); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (!mp[i][j]) continue; g[i].push_back({j}); g[j].push_back({i}); } } auto cl = MaxClique(g).clique; cout << cl.size() << endl; }*/ /* int main() { int n, d; cin >> n >> d; V a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } struct E { int to; }; VV g(n); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if ((a[i] - a[j]) * (a[i] - a[j]) + (b[i] - b[j]) * (b[i] - b[j]) <= d * d) { g[i].push_back({j}); g[j].push_back({i}); } } } auto cl = MaxClique(g).clique; cout << cl.size() << endl; for (int x: cl) cout << x + 1 << " "; cout << endl; }*/