A. Perfect Permutation
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the