class MaxClique: # 最大クリーク # Bron–Kerbosch algorithm (O(1.4422^|V|)) の枝刈りをしたもの # 参考: https://atcoder.jp/contests/code-thanks-festival-2017-open/submissions/2691674 # 検証1: https://atcoder.jp/contests/code-thanks-festival-2017-open/submissions/7620028 # 検証2: https://judge.yosupo.jp/submission/12486 def __init__(self, n): self.n = n self.E = [0] * n self.stk = [0] * n # 最大クリークが入るスタック def __repr__(self): return "\n".join("{:0{}b}".format(e, self.n) for e in self.E) def add_edge(self, v, u): # assert v != u self.E[v] |= 1 << u self.E[u] |= 1 << v def invert(self): # 補グラフにする n, E = self.n, self.E mask = (1<> u & 1: E_sorted_ |= 1 << i E_sorted.append(E_sorted_) self.cans = 1 # 最大クリークを構成する集合 # 復元するときはこれを使う self.ans = 1 self._dfs() return self.ans def _dfs(self): E_sorted = self.E_sorted elem_num = 0 recursive_stk = [(0, (1< self.ans: next = smaller_candi & -smaller_candi candi ^= next smaller_candi ^= next potential -= 1 next = next.bit_length() - 1 if next == pivot or smaller_candi & E_sorted[next]: self.stk[elem_num] = next elem_num += 1 recursive_stk.append((1, candi, potential, pivot, smaller_candi)) recursive_stk.append((0, candi & E_sorted[next])) break else: elem_num -= 1 def main(): mod = 1000003 S = int(input()) S = S * 12345 % mod N = S % 120 + 2 S = S * 12345 % mod P = S mc = MaxClique(N) for i in range(N): for j in range(i+1, N): S = S * 12345 % mod if S < P: mc.add_edge(i, j) ans = mc.solve() + 1 print(ans) print(*[i+1 for i in range(N) if mc.cans>>i&1]) main()