#include <iostream>
#include <vector>

template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
    for (T& a : v)
        input >> a;

    return input;
}

void answer(unsigned v)
{
    std::cout << v << '\n';
}

void solve(const std::vector<unsigned>& p)
{
    const size_t n = p.size();

    unsigned d1 = 0;
    for (size_t i = 0; i < n; ++i)
        d1 += abs(p[i] - (2 * i + 1));

    unsigned d2 = 0;
    for (size_t i = 0; i < n; ++i)
        d2 += abs(p[i] - (2 * i + 2));

    answer(std::min(d1, d2));
}

int main()
{
    size_t n;
    std::cin >> n;

    std::vector<unsigned> p(n / 2);
    std::cin >> p;

    solve(p);

    return 0;
}

