added count occurances in a array using binary search