Report question

Question: Algorithm to count the number of valid blocks in a permutation