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

const ans = line[1].split(' ')
                    .map(Number)
                    .reduce((acc, x, i, arr) => {
                        const tl = arr.slice(i);
                        return acc + tl.filter(y => x > y).length;
                    }, 0);
console.log(ans);

