#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[100010], ans[100010];
int dp[100010][6];
int pre[100010][6];
void same() { return; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= 5; i++) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= 5; j++) {
      if (a[i] < a[i - 1]) {
        for (int k = j + 1; k <= 5; k++) {
          if (dp[i - 1][k]) {
            dp[i][j] = 1;
            pre[i][j] = k;
          }
        }
      } else if (a[i] > a[i - 1]) {
        for (int k = j - 1; k >= 1; k--) {
          if (dp[i - 1][k]) {
            dp[i][j] = 1;
            pre[i][j] = k;
          }
        }
      } else {
        for (int k = 1; k <= 5; k++) {
          if (k == j) {
            continue;
          }
          if (dp[i - 1][k]) {
            dp[i][j] = 1;
            pre[i][j] = k;
          }
        }
      }
    }
  }
  int s = -1;
  for (int i = 1; i <= 5; i++) {
    if (dp[n][i]) {
      s = i;
      break;
    }
  }
  if (s == -1) {
    printf("-1\n");
    return 0;
  }
  int cnt = n;
  while (cnt > 0) {
    ans[cnt] = s;
    s = pre[cnt][s];
    cnt--;
  }
  for (int i = 1; i <= n; i++) {
    printf("%d", ans[i]);
    if (i != cnt) {
      printf(" ");
    } else {
      printf("\n");
    }
  }
  return 0;
}
