using System;
class Program
{
static void Main() {
int[] arr= {1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0};
int left = 0, right = arr.Length - 1;
while (left < right) {
while (arr[left] == 0 && left < right)
left++;
while (arr[right] == 1 && left < right)
right--;
if (left < right) {
arr[left] = 0;
arr[right] = 1;
left++;
right--;
}
}
Console.Write(string.Join(", ", arr));
}
}
/*
run:
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1
*/