According to this definition I expected, for example, for the [itex]J/\psi[/itex] to have [itex]N_{val}=0[/itex], i.e. the same quantum numbers as the vacuum. However, I can't understand what I am doing wrong. Very roughly speaking, in terms of creation/annhilation operators we have:
$$
\hat Q_c\sim (a_{\bar c}+a_c^\dagger)(a_c+a_{\bar c}^\dagger)=a_{\bar c}a_c+a_{\bar c}a^\dagger_{\bar c}+a_ca_c^\dagger+a^\dagger_c a^\dagger_{\bar c}.
$$
Hence, when applied to the particle [itex]|J/\psi\rangle=|\bar c c\rangle[/itex] is should give me:
$$
\hat Q_c|J/\psi\rangle\sim |0\rangle+2|\bar cc\rangle+|\bar c\bar ccc\rangle,
$$ thus giving a number of valence quarks equal to 2. What's wrong with my calculation?

Isn't it [itex]N_c = a_c^\dagger a_c[/itex] for the quarks and [itex]N_{\bar c} = a_{\bar c}^\dagger a_{\bar c}[/itex] for the antiquarks? And then [itex]N = N_c - N_{\bar c}[/itex] is zero for the J/ψ state.

Oh I think I got it. You are right. The point is that in the canonical quantization you need to write the operators using the "good order" prescription. I also wrote it incorrectly, we should have:
$$
\hat Q_c\sim(a_{\bar c}+a_c^\dagger)(a_c+a^\dagger_{\bar c})=a_{\bar c}a_c+a_{\bar c}a_{\bar c}^\dagger+a_c^\dagger a_c+a_c^\dagger a_{\bar c}^\dagger.
$$
In order to have the right order (annihilation on the left) you need to anticommute the second term, thus obtaining the extra minus sign.