#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long double EPS = 1e-14;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const long long p = 97;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(9);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> pr(n, vector<long long>(6, INF));
  pr[0] = vector<long long>(6, -1);
  for (long long i = 1; i < n; i++) {
    for (long long j = 1; j <= 5; j++) {
      if (pr[i - 1][j] == INF) continue;
      for (long long z = 1; z <= 5; z++) {
        if (a[i] > a[i - 1]) {
          if (z > j) {
            pr[i][z] = j;
          }
        } else if (a[i] < a[i - 1]) {
          if (z < j) {
            pr[i][z] = j;
          }
        } else {
          if (z != j) {
            pr[i][z] = j;
          }
        }
      }
    }
  }
  long long last = -1;
  for (long long i = 1; i <= 5; i++) {
    if (pr[n - 1][i] != INF) last = i;
  }
  if (last == -1) {
    cout << -1;
    return 0;
  }
  long long num = n - 1;
  vector<long long> ans;
  while (num != -1) {
    ans.push_back(last);
    last = pr[num][last];
    num--;
  }
  reverse(ans.begin(), ans.end());
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
