#include <bits/stdc++.h>
using namespace std;
const int N = int(2 * 1e5 + 10);
int a[N];
bool z[N][6];
bool used[N][6];
int to[N][6];
bool calcz(int pos, int f) {
  if (used[pos][f]) return z[pos][f];
  used[pos][f] = true;
  if (pos == 0) return z[pos][f] = true;
  if (a[pos - 1] < a[pos]) {
    for (int i = 1; i < f; ++i)
      if (calcz(pos - 1, i)) {
        to[pos][f] = i;
        return z[pos][f] = true;
      }
    return z[pos][f] = false;
  }
  if (a[pos - 1] > a[pos]) {
    for (int i = f + 1; i < 6; ++i)
      if (calcz(pos - 1, i)) {
        to[pos][f] = i;
        return z[pos][f] = true;
      }
    return z[pos][f] = false;
  }
  if (a[pos - 1] == a[pos]) {
    for (int i = 1; i < f; ++i)
      if (calcz(pos - 1, i)) {
        to[pos][f] = i;
        return z[pos][f] = true;
      }
    for (int i = f + 1; i < 6; ++i)
      if (calcz(pos - 1, i)) {
        to[pos][f] = i;
        return z[pos][f] = true;
      }
    return z[pos][f] = false;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans[N];
  for (int f = 1; f <= 5; ++f) {
    if (calcz(n - 1, f)) {
      for (int i = n - 1; i >= 0; --i) {
        ans[i] = f;
        f = to[i][f];
      }
      for (int i = 0; i < n; ++i) cout << ans[i] << " ";
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
