#include <bits/stdc++.h>
using namespace std;
const long long INF64 = 3e18;
const int mod = (int)1e9 + 7;
const int MAX_N = 100000 + 5;
long long binp(long long a, long long b) {
  if (b == 0) return 1;
  long long ans = binp(a, b / 2);
  long long tmp = (ans * ans);
  if (b % 2) return ((tmp * a));
  return ((tmp));
}
long long mbinp(long long a, long long b) {
  a %= mod;
  if (b == 0) return 1;
  long long ans = mbinp(a, b / 2);
  long long tmp = (ans * ans) % mod;
  if (b % 2) return ((tmp * a) % mod);
  return ((tmp) % mod);
}
void display(vector<long long> v) {
  for (auto x : v) cout << x << " ";
  cout << "\n";
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void qr(long long i, long long j) {
  cout << "? " << i << " " << j << '\n';
  cout.flush();
}
void here(long long a) { cout << "here " << a << '\n'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  vector<vector<long long>> dp(n, vector<long long>(5, -1));
  for (long long i = 0; i < 5; i++) dp[0][i] = 9;
  for (long long j = 1; j < n; j++) {
    for (long long i = 0; i < 5; i++) {
      if (dp[j - 1][i] == -1) continue;
      for (long long k = 0; k < 5; k++) {
        if (v[j - 1] == v[j] && i != k) dp[j][k] = i;
        if (v[j - 1] > v[j] && i > k) dp[j][k] = i;
        if (v[j - 1] < v[j] && i < k) dp[j][k] = i;
      }
    }
  }
  bool wrong = true;
  long long next = -1;
  for (long long i = 0; i < 5; i++) {
    if (dp[n - 1][i] != -1) {
      wrong = false;
      next = i;
      break;
    }
  }
  vector<long long> ans;
  ans.push_back(next + 1);
  if (wrong)
    cout << -1 << '\n';
  else {
    for (long long i = n - 1; i >= 1; i--) {
      ans.push_back(dp[i][next] + 1);
      next = dp[i][next];
    }
    reverse(ans.begin(), ans.end());
    display(ans);
  }
}
