#K16111. Power Pair Check

    ID: 24507 Type: Default 1000ms 256MiB

Power Pair Check

Power Pair Check

Given a list of non-negative integers, determine if there exists a pair (x, y) taken from distinct positions in the list such that:

\(x^y = y^x\)

A pair where the values are identical is considered valid (since they come from different positions). For non-identical pairs, observe that for positive integers the only possibility (apart from the trivial case when \(x = y\)) is when one number is 2 and the other is 4, since \(2^4 = 4^2\). More generally, the equality for non-trivial pairs is given by:

\( \frac{\ln(x)}{x} = \frac{\ln(y)}{y} \)

However, for this problem the only distinct non-equal pair to check is (2, 4) (or (4, 2)).

Output True if such a pair exists, otherwise output False.

inputFormat

The input is given via standard input (stdin) and has the following format:

  • The first line contains a single integer \(n\), the number of elements in the list.
  • The second line contains \(n\) space-separated non-negative integers.

outputFormat

Print True if there exists at least one valid pair satisfying the condition; otherwise, print False. The output should be written to standard output (stdout).

## sample
4
2 4 8 16
True

</p>