Well, sure. Whenever you are trying to select nodes which satisfy a particular condition, you would put that condition into an XPathpredicate. And I believe XPath has a count() function: you could look that up.
However both the "td" elements in your example have five descendants which are text. Not four, there's a whitespace text node in both cases. So comparing the number of text descendants wouldn't help in this caswe.