from collections import Counter from bisect import bisect_left N = int(input()) A = list(map(int, input().split())) A.sort() cnt = Counter(A) ans = 0 for a, v in sorted(cnt.items()): ans += v * (v - 1) // 2 * (bisect_left(A, 2 * a) - v) print(ans)