[Python 3]
\ndef maxChunksToSorted(self, arr: List[int]) -> int:\n        d, s, n = collections.defaultdict(collections.deque), sorted(arr), len(arr)\n        for i, x in 
```\ndef maxChunksToSorted(self, arr: List[int]) -> int:\n        d, s, n = collections.defaultdict(collections.deque), sorted(arr), len(arr)\n        for i, x in enumerate(s):\n            d[x].append(i)\n        idx, ans = 0, 0\n        while idx < n:\n            far = d[arr[idx]][0]\n            d[arr[idx]].popleft()\n            while far > idx:\n                idx += 1\n                far = max(far, d[arr[idx]][0])\n                d[arr[idx]].popleft()\n            ans += 1\n            idx = far + 1\n        return ans\n\t\t```
[]