Given an integer array $A=[a_1,a_2,\dots,a_n]$ of length $n$, you need to determine if there exists an integer array $B=[b_1,b_2,\dots,b_n]$ such that the followings hold:
<ol>
<li> The array $B$ is a rearrangement of $A$, i.e., there exists a <strong>permutation</strong> $p=[p_1,p_2,\dots,p_n]$ of size $n$ such that $b_i=a_{p_i}$ for each $1\leq i\leq n$. </li>
<li> The array $B$ doesn't contain any <strong>arithmetic subsequence</strong> of length at least $3$. </li>
</ol>
A sequence $C=[c_1,c_2,\dots,c_k]$ is called an <strong>arithmetic subsequence</strong> of $B$ if and only if the followings are satisfied:
<ol>
<li> There exists a sequence of indices $1\leq i_1\lt i_2\lt\dots\lt i_k\leq N$, such that $c_j=b_{i_j}$ for each $1\leq j\leq k$; </li>
<li> $C$ forms an arithmetic progression, i.e., for each $1
\leq i\leq k-2$, we have $c_{i+2}-c_{i+1}=c_{i+1}-c_{i}$. </li>
</ol>