Remove duplicates when counting to avoid spurious results.