#include <bits/stdc++.h>
using namespace std;
int n, a[100010], f[100010][10], yx[100010][10], jg[100010], cd = 0;
int fg = 0, ls;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= 5; i++) f[1][i] = 1;
  for (int i = 2; i <= n; i++) {
    if (a[i] == a[i - 1]) {
      for (int j = 1; j <= 5; j++)
        for (int k = 1; k <= 5; k++)
          if (j != k && f[i - 1][k]) {
            yx[i][j] = k;
            f[i][j] |= f[i - 1][k];
          }
    } else if (a[i] > a[i - 1]) {
      for (int j = 1; j <= 5; j++)
        for (int k = 1; k <= j - 1; k++)
          if (f[i - 1][k]) {
            yx[i][j] = k;
            f[i][j] |= f[i - 1][k];
          }
    } else if (a[i] < a[i - 1]) {
      for (int j = 1; j <= 5; j++)
        for (int k = j + 1; k <= 5; k++)
          if (f[i - 1][k]) {
            yx[i][j] = k;
            f[i][j] |= f[i - 1][k];
          }
    }
  }
  for (int i = 1; i <= 5; i++) {
    if (f[n][i] == 1) {
      fg = 1;
      ls = i;
      break;
    }
  }
  if (fg == 0) {
    printf("-1\n");
    return 0;
  }
  jg[++cd] = ls;
  int j = n;
  while (yx[j][ls]) {
    jg[++cd] = yx[j][ls];
    ls = yx[j][ls];
    j--;
  }
  for (int i = cd; i >= 1; i--) printf("%d ", jg[i]);
  printf("\n");
  return 0;
}
