import bisect import collections N = int(input()) A = list(map(int, input().split(' '))) A.sort() ans = 0 for l, n in collections.Counter(A).items(): if n >= 2: m = bisect.bisect(A, l*2-1) - n ans += m * n * (n-1) // 2 print(ans)