#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
const int maxn = (long long)1e5 + 5;
const int mod = (long long)998244353;
const int inf = 0x3f3f3f3f;
int dp[maxn][6];
int a[maxn];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= 5; ++i) dp[1][i] = 1;
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= 5; ++j) {
      for (int k = 1; k <= 5; ++k) {
        if (!dp[i - 1][k]) continue;
        if (a[i - 1] < a[i] && k < j) dp[i][j] = k;
        if (a[i - 1] > a[i] && k > j) dp[i][j] = k;
        if (a[i - 1] == a[i] && k != j) dp[i][j] = k;
      }
    }
  }
  vector<int> ans;
  for (int j = 1; j <= 5; ++j) {
    if (dp[n][j]) {
      ans.push_back(j);
      for (int i = n; i >= 2; --i) {
        j = dp[i][j];
        ans.push_back(j);
      }
      break;
    }
  }
  if (ans.empty())
    cout << -1;
  else
    for (int i = ans.size() - 1; i >= 0; --i) cout << ans[i] << ' ';
  return 0;
}
