#include <bits/stdc++.h>
using namespace std;
template <class T>
string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
int nint() {
  int x;
  scanf("%d", &x);
  return x;
}
const long long mod = 1000000000 + 7;
int m;
int n;
long long ans;
int a[100500];
int ne[100500][6];
int table[100500][6];
int getans(int p, int last) {
  if (p == n) return 1;
  int &ans = table[p][last];
  if (ans != -1) return ans;
  ans = 0;
  for (int i = 1; i <= 5; i++) {
    if (i == last && a[p] == a[p - 1]) continue;
    if (i >= last && a[p] < a[p - 1]) continue;
    if (i <= last && a[p] > a[p - 1]) continue;
    if (getans(p + 1, i)) {
      ans = 1;
      ne[p][last] = i;
    }
  }
  return ans;
}
vector<int> restore(int p, int last) {
  vector<int> ans;
  while (p != n) {
    int i = ne[p][last];
    ans.emplace_back(i);
    p++;
    last = i;
  }
  return ans;
}
int main() {
  do {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  } while (0);
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> a[i];
  memset(table, -1, sizeof(table));
  for (int i = 1; i <= 5; i++) {
    if (getans(1, i)) {
      cout << i << ' ';
      vector<int> v = restore(1, i);
      for (int x : v) cout << x << ' ';
      return 0;
    }
  }
  cout << -1;
}
