#include using namespace std; using ll = long long; int main(){ int ans=0, N, A; cin >> N; vector P(N); for (int i=0; i> A; A--; P[A] = i; } vector used(N+1); for (int i=0; i