const line = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

const solve = arr => {
    if (arr.length === 1) return 0;
    const hd = arr[0];
    const tl = arr.slice(1);
    return solve(tl) + tl.filter(x => hd > x).length;
}

const list = line[1].split(' ').map(Number);
console.log(solve(list));

