```
class Solution(object):
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
red, white, blue = 0, 0, 0
for i in range(len(nums)):
if nums[i] == 0:
red += 1
elif nums[i] == 1:
white += 1
elif nums[i] == 2:
blue += 1
for h in range(red):
nums[h] = 0
for j in range(red, red + white):
nums[j] = 1
for k in range(red + white, red + white + blue):
nums[k] = 2
```