#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100001], fin[100001];
bool used[100001][5];
int dfs(int u) {
  if (u == n) return 1;
  for (int i = 1; i <= 5; ++i) {
    if (used[u][i - 1]) continue;
    if ((arr[u] == arr[u + 1] and fin[u] != i) or
        (arr[u] < arr[u + 1] and fin[u] < i) or
        (arr[u] > arr[u + 1] and fin[u] > i)) {
      fin[u + 1] = i;
      used[u][i - 1] = true;
      if (dfs(u + 1)) return 1;
    }
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", arr + i);
  bool b = false;
  for (int i = 1; i <= 5; ++i) {
    fin[1] = i;
    if (dfs(1)) {
      b = true;
      break;
    }
  }
  if (b) {
    for (int i = 1; i <= n; ++i) printf("%d ", fin[i]);
    printf("\n");
  } else {
    printf("-1\n");
  }
  return 0;
}
