Farmer John is hosting a tennis tournament with his *n* cows. Each cow has a skill level *s*<sub class="lower-index">*i*</sub>, and no two cows having the same skill level. Every cow plays every other cow exactly once in the tournament, and each cow beats every cow with skill level lower than its own.

However, Farmer John thinks the tournament will be demoralizing for the weakest cows who lose most or all of their matches, so he wants to flip some of the results. In particular, at *k* different instances, he will take two integers *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> (*a*<sub class="lower-index">*i*</sub> &lt; *b*<sub class="lower-index">*i*</sub>) and flip all the results between cows with skill level between *a*<sub class="lower-index">*i*</sub> and *b*<sub class="lower-index">*i*</sub> inclusive. That is, for any pair *x*, *y* <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/57add0354e27dbc2e3c27b74ec0078855596d12b.png" style="max-width: 100.0%;max-height: 100.0%;"/> he will change the result of the match on the final scoreboard (so if *x* won the match, the scoreboard will now display that *y* won the match, and vice versa). It is possible that Farmer John will change the result of a match multiple times. It is not guaranteed that *a*<sub class="lower-index">*i*</sub> and *b*<sub class="lower-index">*i*</sub> are equal to some cow's skill level.

Farmer John wants to determine how balanced he made the tournament results look. In particular, he wants to count the number of triples of cows (*p*, *q*, *r*) for which the final leaderboard shows that cow *p* beats cow *q*, cow *q* beats cow *r*, and cow *r* beats cow *p*. Help him determine this number.

Note that two triples are considered different if they do not contain the same set of cows (i.e. if there is a cow in one triple that is not in the other).
On the first line are two space-separated integers, *n* and *k* (3 ≤ *n* ≤ 10<sup class="upper-index">5</sup>; 0 ≤ *k* ≤ 10<sup class="upper-index">5</sup>). On the next line are *n* space-separated distinct integers, *s*<sub class="lower-index">1</sub>, *s*<sub class="lower-index">2</sub>, ..., *s*<sub class="lower-index">*n*</sub> (1 ≤ *s*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>), denoting the skill levels of the cows. On the next *k* lines are two space separated integers, *a*<sub class="lower-index">*i*</sub> and *b*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> &lt; *b*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) representing the changes Farmer John made to the scoreboard in the order he makes it.
print("_RANDOM_GUESS_1689602929.773021")# 1689602929.77304