use defaultdict(int) instead of Counter for Python 2.6