#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
const int MOD = 1e9 + 7;
int n, a[N], dp[N][6], dp2[N][6];
vector<int> v;
int f(int idx, int last) {
  if (idx == n + 1) {
    return 1;
  }
  int &ans = dp[idx][last];
  if (ans ^ -1) return ans;
  ans = 0;
  for (int i = 1; i <= 5; ++i) {
    if (i != last) {
      if (a[idx] > a[idx - 1] and i > last) {
        if (f(idx + 1, i)) {
          dp2[idx][last] = i;
          return ans = 1;
        }
      } else if (a[idx] < a[idx - 1] and i < last) {
        if (f(idx + 1, i)) {
          dp2[idx][last] = i;
          return ans = 1;
        }
      } else if (a[idx] == a[idx - 1]) {
        if (f(idx + 1, i)) {
          dp2[idx][last] = i;
          return ans = 1;
        }
      }
    }
  }
  return ans;
}
int32_t main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof(dp));
  if (!f(1, 0)) {
    cout << -1;
    return 0;
  }
  int last = 0;
  for (int i = 1; i <= n; ++i) {
    v.push_back(dp2[i][last]), last = dp2[i][last];
  }
  for (auto &it : v) cout << it << " ";
  return 0;
}
