adding counting in algos