'use strict';

const testcase = null;

function main(input) {
    const n = parseInt(input.shift());
    const ls = [];
    const s = new Array(2200).fill(0);
    const m = new Array(2200).fill(0);
    for (var i = 0; i < n; i++) {
        const l = parseInt(input.shift());
        for (var ll of ls) {
            s[l + ll] += 1;
            m[Math.min(l, ll)] += 1;
        }
        ls.push(l);
    }
    for (var i = 0; i < 2100; i++) {
        m[2099 - i] += m[2100 - i];
        s[i + 1] += s[i];
    }
    var total = 0;
    for (var l of ls) {
        //console.log(l, s[l - 1], m[l + 1]);
        total += m[l + 1] - s[l];
    }
    console.log(total);
}

if (process.argv[1] == __filename) {
    const input = testcase
        || require('fs')
            .readFileSync('/dev/stdin', 'utf-8');
    main(input.split(/\s/));
}
