#include <solution/3201.h>

#define max(x, y) ((x) > (y) ? (x) : (y))

int maximumLength(int *nums, int numsSize)
{
    int odd = 0, even = 0, odd_cnt = 0;

    for (int i = 0; i < numsSize; i++)
        nums[i] & 1 ? (odd = even + 1, odd_cnt++) : (even = odd + 1);

    return max(max(even, odd), max(odd_cnt, numsSize - odd_cnt));
}
