3.0
Swift 3 introduces the CountedSet class (it's the Swift version of the NSCountedSet Objective-C class).
CountedSet, as suggested by the name, keeps track of how many times a value is present.
let countedSet = CountedSet()
countedSet.add(1)
countedSet.add(1)
countedSet.add(1)
countedSet.a...