N = int(input())
L = sorted(list(map(int, input().split())))[::-1]


def is_ok(i, x):
    return L[i] > x


def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok


ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = bisect(N, j, L[i] - L[j])
        ans += k - j
print(ans) N = int(input()) N int(input()) int input() input L = sorted(list(map(int, input().split())))[::-1] L sorted(list(map(int, input().split())))[::-1] (list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ::-1 -1 def is_ok(i, x):
    return L[i] > x is_ok return L[i] > x L[i] > x L[i] L i x i i x x def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok bisect while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
     abs(ok - ng) > 1 abs(ok - ng) abs ok - ng ok ng 1 mid = (ok + ng) // 2 mid (ok + ng) // 2 ok + ng ok ng 2 if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
     is_ok(mid, x) is_ok mid x ok = mid ok mid ng = mid ng mid return ok ok ng ng ok ok x x ans = 0 ans 0 for i in range(N):
    for j in range(i + 1, N):
        k = bisect(N, j, L[i] - L[j])
        ans += k - j i range(N) range N for j in range(i + 1, N):
        k = bisect(N, j, L[i] - L[j])
        ans += k - j j range(i + 1, N) range i + 1 i 1 N k = bisect(N, j, L[i] - L[j]) k bisect(N, j, L[i] - L[j]) bisect N j L[i] - L[j] L[i] L i L[j] L j ans += k - j ans k - j k j print(ans) print ans ans = 0 0 ans def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok bisect def is_ok(i, x):
    return L[i] > x def is_ok(i, x):
    return L[i] > x is_ok N = int(input()) int(input()) N L = sorted(list(map(int, input().split())))[::-1] sorted(list(map(int, input().split())))[::-1] L ans += k - j k - j ans k = bisect(N, j, L[i] - L[j]) bisect(N, j, L[i] - L[j]) k
N = int(input())
L = sorted(list(map(int, input().split())))[::-1]


def is_ok(i, x):
    return L[i] > x


def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok


ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = bisect(N, j, L[i] - L[j])
        ans += k - j
print(ans)
