The Cordillera Oriental is a mountain range in the Andes that stretches across Bolivia. It consists of a sequence of $N$ mountain peaks, numbered from $0$ to $N - 1$. The height of peak $i$ ($0 \leq i < N$) is $H[i]$, which is an integer between $1$ and $N - 1$, inclusive.
For any two peaks $i$ and $j$ where $0 \leq i < j < N$, the distance between them is defined as $d(i, j) = j - i$.
According to ancient Inca legends, a triple of peaks is mythical if it has the following special property: the heights of the three peaks match their pairwise distances ignoring the order.
Formally, a triple of indices $(i, j, k)$ is mythical if
This problem consists of two parts, with each subtask associated with either Part I or Part II. You may solve the subtasks in any order. In particular, you are not required to complete all of Part I before attempting Part II.