Don't use Counter(). It is not compatible with Python 2.6.
Added compatibility with Python 2.6.