import bisect from collections import Counter from math import comb N = int(input()) A = sorted(list(map(int,input().split()))) ac = Counter(A) ans = 0 for i in ac: if(ac[i] >= 2): MAX = i*2 ans += comb(ac[i],2) * (bisect.bisect_left(A,MAX) - ac[i]) print(ans)