#include using namespace std; using ll = long long; const int BITLEN=60; //bitsetの昇順 bool bitasc(const bitset &a, const bitset &b){ for (int i=BITLEN-1; i>=0; i--){ if (a[i] != b[i]){ return a[i] < b[i]; } } return false; } //bitsetのmin bitset min(bitset a, bitset b){ if (bitasc(a, b)) return a; return b; } const ll modc=998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll N, A; cin >> N; vector, int>> vec(N); vector, int>> base; for (int i=0; i> A; vec[i] = {A, i}; } //A_iに作用したindex vector> v(N); vector cnt(N), ans; auto dfs=[&](auto self, int from)->void{ cnt[from]++; for (auto to : v[from]){ self(self, to); } }; for (int i=0; i