n = int(input())
L = sorted(list(map(int, input().split())), reverse=True)
L.append(0)

def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    judge = L[i] < L[j] + L[arg]
#    print(judge, i, j, arg, L[i], L[j], L[arg])
    return judge

def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

count = 0
for i in range(n):
    for j in range(i+1, n):
        k = meguru_bisect(n+1, j)
        if k > j:
            #print(i, j, k, L[i], L[j], L[k])
            count += k - j
print(count) n = int(input()) n int(input()) int input() input L = sorted(list(map(int, input().split())), reverse=True) L sorted(list(map(int, input().split())), reverse=True) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split reverse=True reverse True L.append(0) L.append L append 0 def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    judge = L[i] < L[j] + L[arg]
#    print(judge, i, j, arg, L[i], L[j], L[arg])
    return judge is_ok judge = L[i] < L[j] + L[arg] judge L[i] < L[j] + L[arg] L[i] L i L[j] + L[arg] L[j] L j L[arg] L arg return judge judge arg arg def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok meguru_bisect '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    ''' while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            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):
            ok = mid
        else:
            ng = mid
     is_ok(mid) is_ok mid ok = mid ok mid ng = mid ng mid return ok ok ng ng ok ok count = 0 count 0 for i in range(n):
    for j in range(i+1, n):
        k = meguru_bisect(n+1, j)
        if k > j:
            #print(i, j, k, L[i], L[j], L[k])
            count += k - j i range(n) range n for j in range(i+1, n):
        k = meguru_bisect(n+1, j)
        if k > j:
            #print(i, j, k, L[i], L[j], L[k])
            count += k - j j range(i+1, n) range i+1 i 1 n k = meguru_bisect(n+1, j) k meguru_bisect(n+1, j) meguru_bisect n+1 n 1 j if k > j:
            #print(i, j, k, L[i], L[j], L[k])
            count += k - j k > j k j count += k - j count k - j k j print(count) print count L = sorted(list(map(int, input().split())), reverse=True) sorted(list(map(int, input().split())), reverse=True) L def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    judge = L[i] < L[j] + L[arg]
#    print(judge, i, j, arg, L[i], L[j], L[arg])
    return judge def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    judge = L[i] < L[j] + L[arg]
#    print(judge, i, j, arg, L[i], L[j], L[arg])
    return judge is_ok def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok meguru_bisect count += k - j k - j count count = 0 0 count k = meguru_bisect(n+1, j) meguru_bisect(n+1, j) k n = int(input()) int(input()) n
n = int(input())
L = sorted(list(map(int, input().split())), reverse=True)
L.append(0)

def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    judge = L[i] < L[j] + L[arg]
#    print(judge, i, j, arg, L[i], L[j], L[arg])
    return judge

def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

count = 0
for i in range(n):
    for j in range(i+1, n):
        k = meguru_bisect(n+1, j)
        if k > j:
            #print(i, j, k, L[i], L[j], L[k])
            count += k - j
print(count)
