#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int dp[N][10], n, a[N], construct[N][10];
int solve(int i, int finger) {
  if (i == n + 1) return 1;
  if (dp[i][finger] != -1) return dp[i][finger];
  int f = 0, currentFinger;
  if (a[i] > a[i - 1]) {
    for (int j = finger + 1; j <= 5; j++) {
      if (solve(i + 1, j)) f = 1, currentFinger = j;
    }
  }
  if (a[i] < a[i - 1]) {
    for (int j = finger - 1; j >= 1; j--) {
      if (solve(i + 1, j)) f = 1, currentFinger = j;
    }
  }
  if (a[i] == a[i - 1]) {
    for (int j = 1; j <= 5; j++) {
      if (j == finger) continue;
      if (solve(i + 1, j)) f = 1, currentFinger = j;
    }
  }
  if (f) construct[i][finger] = currentFinger;
  return dp[i][finger] = f;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  if (solve(1, 0) == 0)
    cout << -1;
  else {
    int x = 1, y = 0;
    while (x <= n) {
      cout << construct[x][y] << " ";
      y = construct[x][y], x += 1;
    }
  }
  return 0;
}
