Non-recursive and count the duplicates nodes