#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n, cnt, lat[801];
int main() {
    fin >> n;
    for(int i = 1; i <= n; i++){
        fin >> lat[i];
    }
    fin.close();
    sort(lat + 1, lat + n + 1);
    for(int i = 1; i <= n - 2; i++) {
        for(int j = i + 1; j <= n - 1; j++) {
            int a = lat[i];
            int b = lat[j];
            int st = j + 1, dr = n;
            while(st <= dr) {
                int mij = (dr + st) / 2;
                if (lat[mij] <= a + b) {
                    st = mij + 1;
                } else { 
                    dr = mij - 1;
                }
            }
            cnt += dr - j;
        }
    }
    fout << cnt;
    fout.close();
    return 0;
}