#include <bits/stdc++.h>
using namespace std;
long long int em(long long int x, long long int Mod, long long int n) {
  if (n == 0)
    return 1ll;
  else if (n % 2 == 0)
    return em((x % Mod * x % Mod) % Mod, Mod, n / 2) % Mod;
  else
    return (x % Mod * em((x % Mod * x % Mod) % Mod, Mod, (n - 1) / 2)) % Mod;
}
long long int arr[200002], val[200002];
long long int dp[200002][6], child[200002][6], n;
long long int fun(long long int idx, long long int req) {
  long long int i, j;
  if (idx == n) return dp[idx][req] = 1;
  if (dp[idx][req] != -1) return dp[idx][req];
  long long int ans = 0;
  if (arr[idx + 1] == arr[idx]) {
    for (i = 1; i <= 5; i++) {
      if (i != req) {
        long long int ret = fun(idx + 1, i);
        if (ret == 1) {
          child[idx][req] = i;
          ans = 1;
        }
      }
    }
  } else if (arr[idx + 1] > arr[idx]) {
    for (i = req + 1; i <= 5; i++) {
      long long int ret = fun(idx + 1, i);
      if (ret == 1) {
        child[idx][req] = i;
        ans = 1;
      }
    }
  } else {
    for (i = 1; i < req; i++) {
      long long int ret = fun(idx + 1, i);
      if (ret == 1) {
        child[idx][req] = i;
        ans = 1;
      }
    }
  }
  return dp[idx][req] = ans;
}
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, l;
  cin >> n;
  arr[0] = 1e9;
  for (long long int i = (long long int)1; i < (long long int)n + 1; i++)
    cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  long long int possible = fun(0, 5);
  if (!possible)
    cout << "-1\n";
  else {
    long long int here = child[0][5];
    i = 1;
    while (i <= n) {
      cout << here << " ";
      here = child[i++][here];
    }
  }
}
