#ABC231F. [ABC231F] Jealous Two

[ABC231F] Jealous Two

Score : 500500 points

Problem Statement

Snuke is planning on giving one gift each to Takahashi and Aoki. There are NN candidates for the gifts. Takahashi's impression of the ii-th candidate is AiA_i, and Aoki's impression of it is BiB_i.

The two are very jealous. If Takahashi's impression of the gift Aoki gets is greater than Takahashi's impression of the gift Takahashi gets, Takahashi gets jealous of Aoki and starts fighting, and vice versa.

Among the N2N^2 possible ways of giving the gifts, how many do not lead to fighting?

Constraints

  • 1N2×1051 \leq N \leq 2\times 10^5
  • 0Ai1090 \leq A_i \leq 10^9
  • 0Bi1090 \leq B_i \leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 \ldots ANA_N

B1B_1 \ldots BNB_N

Output

Print the answer.

3
50 100 150
1 3 2
4

For example, if we give the 11-st candidate to Takahashi and the 22-nd candidate to Aoki, Takahashi's impression of the gift Aoki gets is 100100, while Takahashi's impression of the gift Takahashi gets is 5050, so Takahashi gets jealous of Aoki and starts fighting.

As another example, if we give the 33-rd candidate to Takahashi and the 22-nd candidate to Aoki, the two will not start fighting.

Note that it is allowed to give the same gift to the two.

3
123456789 123456 123
987 987654 987654321
6
10
3 1 4 1 5 9 2 6 5 3
2 7 1 8 2 8 1 8 2 8
37