If there's more than one CF_NULL in the list (somehow, don't ask me), this shall still get the wrong answer.
I would replace null_seen with a counter nulls, then you can simply count -= nulls; here.