var lines = []; var N;
var result = 0;
var a;
var readline = require('readline');
var MOD = 998244353;

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    N = Number(lines[0]);
    lines.shift();
    a = Array(N);
    for (var i = 0; i < N; i++) {
        a[i] = Number(lines[i]);
    }

    dfs(0, []);
    console.log(result);

});

// 赤:0 緑:1 青:2
function dfs(n, comb) {
    if (n === N) {
        var red = 0; var green = 0; var blue = 0;
        for (var i = 0; i < N; i++) {

            if (comb[i] === 0) { red = red + a[i]; }
            else if (comb[i] === 1) { green = green + a[i] }
            else { blue = blue + Number(a[i]) }

        }
        if (red !== 0 && green !== 0 && blue !== 0 && (red + green > blue && red + blue > green && blue + green > red)) {result++; }
    }
    else {
        for (var i = 0; i < 3; i++) {
            comb[n] = i
            dfs(n + 1, comb);
        }
    }
}