bettwe version of count occurances problem