Excel, 130 97 bytes
-33 bytes applying Bubbler's formula
=LET(x,COUNT(A1#),a,SEQUENCE(x),b,SUM(MOD(MMULT(A1#,(a<=TRANSPOSE(a))*1),2)),b*(b-1-x)+(x^2+x)/2)
Link to Spreadsheet
Rearranged Bubbler's formula to use the number of 1s and size of the original array (instead of the number of 0s). Multiplies the array by an upper triangular matrix to calculate the cumulative sums.
Original Answer not using Bubbler's method
=LET(x,COUNT(A1#),a,SEQUENCE(1,x^2)-1,b,MOD(a,x)+1,c,INT(a/x)+1,d,SEQUENCE(x),SUM(1-MOD(MMULT(A1#,FILTER((d>=b)*(d<=c),b<=c)),2)))
Explanation
Since Excel formulas don't really have loops, I have to get creative with in sequences in two dimensional space.
LET(x,COUNT(A1#),
: x = number of elements
a,SEQUENCE(1,x^2)-1,
: a = [0..x^2]
b,MOD(a,x)+1,
: b = array of indices of the first items to be summed
c,INT(a/x)+1,
: c = array of indices of the last items to be summed
d,SEQUENCE(x),
: d = [1..x]
FILTER((d>=b)*(d<=c),b<=c))
: array containing all permutations of possible consecutive sums indicated by 1 in the elements to be summed
MMULT(A1#,~,2)
: use matrix multiplication to determine all the sums of consecutive elements
SUM(1-MOD(~,2)))
: count the sums where the sum mod 2 = 0
n0*(n0-1)/2+n1*(n1-1)/2
. Probably not so appealing for golf though. \$\endgroup\$n0*n1
. \$\endgroup\$