Can someone explain how to solve the question below, Much appreciated!

Given an integer arr[] of size n, your task is to count the number of magical subarrays in the arr.

Here any subarray arr[l…r] is considered to be magical if it satisfies the magical condition.

it should contain an even number(non zero) of odd numbers

More Formally the count of odd numbers in the subarray should be even and should be greater than 0

#TestCase 1;

Input:

n=4

arr[]={2,1,2,3}

output:2

the magical subarrays are: {2,1,2,3} , {1,2,3}

#Testcase 2

n=6

arr[]={1,2,5,2,3,7}

output:7

the magical subarrays are:{1,2,5}, {1,2,5,2}, {2,5,2,3}, {5,2,3}, {2,3,7}, {3,7}, {1,2,5,2,3,7}