LearnPy Hub
← Arena
AdvancedRating 1900

Double Inversions

Count the pairs i < j with aᵢ > 2·aⱼ.

Input

n, then n integers.

Output

One integer.

Sample 1

Input
5
1 3 2 3 1
Output
2

Sample 2

Input
5
2 4 3 5 1
Output
3
solution.py
Output appears here
Double Inversions · Python Arena problem · LearnPy Hub