Counts occurrences and identifies repeated elements.