# list = [11, 0, 0, 8 ,5]


list = [0, 1, 0, 1 ,0]
print list

length = len(list)
# print(length)


count_of_zeros = 0
for i in range(0, length):
    # print (list[i])
    if (list[i] == 0 and count_of_zeros < length-(i+1)):
        
        list[i] = list[length-(count_of_zeros+1)] 
        list[length-(count_of_zeros+1)]  = 0
        count_of_zeros = count_of_zeros + 1

print (list)