Counting terms in an expression