repeated elements count, algorithm based on a linear time majority vote principle