You can try belo not tested but something like this should work. I am checking if the attributes are present and your check then provide the count.
int count= selenium.getXpathCount("xpath=//a[@onmousedown and @href and @data-cthref and contains(@href,'www.seleniumhq.org')]").intValue();