#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 11, mod = 1e9 + 7;
const int MAX = 2e7;
const int INF1 = 2e9 + 11;
const long long INF2 = 2e18 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-9;
const double PI = acos(-1.0);
int n, a[N], pr[N][7];
bool dp[N][7];
int main() {
  if (fopen("lca"
            ".in",
            "r"))
    freopen(
        "lca"
        ".in",
        "r", stdin),
        freopen(
            "lca"
            ".out",
            "w", stdout);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i += 1) cin >> a[i];
  for (int i = 1; i <= 5; i += 1) dp[1][i] = 1;
  for (int i = 2; i <= n; i += 1) {
    if (a[i] > a[i - 1]) {
      for (int last = 1; last <= 4; last += 1) {
        for (int nxt = last + 1; nxt <= 5; nxt += 1) {
          if (dp[i - 1][last]) dp[i][nxt] = 1, pr[i][nxt] = last;
        }
      }
    }
    if (a[i] < a[i - 1]) {
      for (int last = 2; last <= 5; last += 1) {
        for (int nxt = 1; nxt <= last - 1; nxt += 1) {
          if (dp[i - 1][last]) dp[i][nxt] = 1, pr[i][nxt] = last;
        }
      }
    }
    if (a[i] == a[i - 1]) {
      for (int last = 1; last <= 5; last += 1) {
        for (int nxt = 1; nxt <= 5; nxt += 1) {
          if (last != nxt && dp[i - 1][last]) {
            dp[i][nxt] = 1;
            pr[i][nxt] = last;
          }
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 1; i <= 5; i += 1) {
    if (dp[n][i]) {
      int el = i;
      while (pr[n][el]) ans.emplace_back(el), el = pr[n][el], --n;
      ans.emplace_back(el);
      reverse(ans.begin(), ans.end());
      for (int& it : ans) cout << it << " ";
      return 0;
    }
  }
  cout << -1;
  return 0;
}
