#include <bits/stdc++.h>
using namespace std;
long long dx[4] = {0, 1, -1, 0};
long long dy[4] = {1, 0, 0, -1};
const int MAXN = 2e5 + 5;
long long mod = 1000000007;
vector<long long> gr[200005];
long long a[200005];
long long b[200005];
long long c[200005];
long long inf = 1e17;
long double eps = 1e-17;
long long n;
long long dp[100005][5];
long long go[100005][5];
bool calc(long long v, long long last) {
  if (v == n) return 1;
  long long &res = dp[v][last];
  if (~res) return res;
  res = 0;
  if (a[v] < a[v + 1]) {
    for (long long i = int(last + 1); i < int(5); i++) {
      if (calc(v + 1, i)) {
        res = 1;
        go[v][last] = i;
        break;
      }
    }
  } else if (a[v] > a[v + 1]) {
    for (long long i = int(0); i < int(last); i++) {
      if (calc(v + 1, i)) {
        res = 1;
        go[v][last] = i;
        break;
      }
    }
  } else {
    for (long long i = int(0); i < int(5); i++) {
      if (last == i) continue;
      if (calc(v + 1, i)) {
        res = 1;
        go[v][last] = i;
        break;
      }
    }
  }
  return res;
}
void solve() {
  cin >> n;
  for (long long i = int(0); i < int(n); i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  for (long long i = int(0); i < int(5); i++) {
    if (calc(0, i)) {
      for (long long j = 0, last = i; j < n; last = go[j++][last]) {
        cout << last + 1 << " ";
      }
      return;
    }
  }
  cout << -1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
