#include <stdio.h> int main() { int n, i, j, a[110], t; scanf("%d", &n); for(i=1; i<=n; i++) scanf("%d", &a[i]); for(i=1; i<=n-1; i+=2) for(j=1; j<=n-i-1; j+=2) if(a[j]>a[j+2]) { t = a[j]; a[j] = a[j+2]; a[j+2] = t; } for(i=2; i<=n; i+=2) for(j=2; j<=n-i; j+=2) if(a[j]<a[j+2]) { t = a[j]; a[j] = a[j+2]; a[j+2] = t; } for(i=1; i<n; i++) printf("%d ", a[i]); printf("%d", a[n]); }