function Main(_input) {
    const lines = _input.split("\n");
    const first = lines[0].split(' ');
    const second = lines[1].split(' ');
    const num = first[0];
    const height = [];
    let r = 0;

    for (let i = 0; i < num; i++) {
        height[i] = parseInt(second[i], 10);
    }

    for (let i = 0; i < num; i++) {
        for (let j = 0; j < num; j++) {
            if (i !== j) {
                const sub = Math.abs(i - j);
                const sum = height[i] + height[j];

                if (sub === sum) {
                    r++;
                }
            }
        }
    }

    console.log(r / 2);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));