#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 100000;
int f[N + 5][6];
int a[N + 5];
void dfs(int i, int k) {
  if (i == 0) return;
  dfs(i - 1, f[i][k]);
  printf("%d ", k);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[1][1] = f[1][2] = f[1][3] = f[1][4] = f[1][5] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 5; j++) {
      if (a[i] > a[i - 1]) {
        for (int k = 1; k < j; k++)
          if (f[i - 1][k] != 0) f[i][j] = k;
      }
      if (a[i] == a[i - 1]) {
        for (int k = 1; k <= 5; k++)
          if (k != j && f[i - 1][k] != 0) f[i][j] = k;
      }
      if (a[i] < a[i - 1]) {
        for (int k = j + 1; k <= 5; k++)
          if (f[i - 1][k] != 0) f[i][j] = k;
      }
    }
  }
  for (int i = 1; i <= 5; i++)
    if (f[n][i] != 0) {
      dfs(n, i);
      return 0;
    }
  printf("-1");
}
