We show that for every sufficiently large $n$, the number of monotone
subsequences of length four in a permutation on $n$ points is at least
$\binom{\lfloor n/3 \rfloor}{4} + \binom{\lfloor(n+1)/3\rfloor}{4} +
\binom{\lfloor (n+2)/3\rfloor}{4}$. Furthermore, we characterize all
permutations on $[n]$ that attain this lower bound. The proof uses the flag
algebra framework together with some additional stability arguments. This
problem is equivalent to some specific type of edge colorings of complete
graphs with two colors, where the number of monochromatic $K_4$'s is minimized.
We show that all the extremal colorings must contain monochromatic $K_4$'s only
in one of the two colors. This translates back to permutations, where all the
monotone subsequences of length four are all either increasing, or decreasing
only.