#import<bits/stdc++.h>
int a[900],n,x,i,j,k,r;main(){std::ifstream f{"nrtri.in"};for(f>>n;x<n;f>>a[x++]);std::sort(a,a+n);for(;i<n;++i)for(j=i+1;j<n;++j)for(k=j+1;k<n&&a[k++]<=a[i]+a[j];++r);std::ofstream{"nrtri.out"}<<r;}