#include <bits/stdc++.h>
using namespace std;
int up, down, a[200050], n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  up = -1, down = 200050;
  for (int i = 1; i <= n; i++) {
    if (a[i] > up && a[i] < down) {
      if (a[i] < a[i + 1]) {
        up = a[i];
        a[i] = 0;
      } else {
        down = a[i];
        a[i] = 1;
      }
    } else if (a[i] < down) {
      down = a[i];
      a[i] = 1;
    } else if (a[i] > up) {
      up = a[i];
      a[i] = 0;
    } else {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  printf("%d", a[1]);
  for (int i = 2; i <= n; i++) printf(" %d", a[i]);
  printf("\n");
  return 0;
}
