Let there be n number of terms.

Out of which n/2 are even or odd.

Let first term be a , last be a+(n-1)d.

Given

(n-1)d=21/2

And, a+(a+2d)+(a+4d)+....a+(n-2)d=24 (n/2 terms)

a+d+(a+3d)+(a+5d)+.....+a+(n-1)d=30 (n/2 terms)

Subtracting we get , nd/2=6

or nd=12

Solving both equation gives , n=8