#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 ans, cnt; map> mp; auto dfs=[&](auto self, int from)->vector{ if (mp.count(from)) return mp[from]; vector res(N), res2; res[from]++; for (auto to : v[from]){ assert(to < from); res2 = self(self, to); for (int i=0; i