typedef enum { BLUE, WHITE, RED } color;

void swap(color t[], int i, int j) {color c = t[i]; t[i]=t[j]; t[j]=c; }

void dutch(color t[], int n)
{
	int b=0, w=0, r=n;

	while (w<r)
		switch (t[w]) {
			case BLUE:	swap(t, b++, w++); break;
			case WHITE:	w++; break;
			case RED:	swap(t, --r, w); break;
		}
}
