Triplets
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given three ranges of integers ([a, A]), ([b, B]), and ([c, C]), determine the total number of ordered triples of integers ((x, y, z)) that satisfy the following conditions:
(x y)
(x z)
(y z)
(a x A)
(b y B)
(c z C)
Input
The first line of the input contains the integer (N). The second line contains (N) integers, separated by spaces, representing the sequence ((a, A, b, B, c, C)) where (a A), (b B), (c C), and (-10^3 a, b, c, A, B, C 10^3).
Output
Output a single line containing the answer to the problem.
Examples
Input #1
Answer #1
Submissions 47
Acceptance rate 49%