function main(input) {
    var n = input[0]-0;
    var lists = input[1].split(" ").map(v=>v-0);
    var list = input[1].split(" ").map((v, i)=>{
        return v-(i+1);
    }).sort((a,b)=>a-b);
    console.log(calc(lists, list[~~(n/2)]));
}
function calc(list, b){
    var ans = 0;
    list.forEach((v,i)=>{
        ans += Math.abs(list[i]-(b+i+1));
    });
    return ans;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));


