count subarrays of length three with a condition

visit shbcf.ru