public static int numberOfInversionsB(List<Element> a) {
        int counter = 0;

        for (int i = 0; i < a.size() - 1; i++) {
            if (a.get(i).getValue() > a.get(i + 1).getValue()) {
                counter++;
            }
        }

        return counter;
    }