#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2 * 1e5 + 1;
const long long INF = 1e9;
const long long MOD = 1e9 + 7;
const long double EPS = 1e-12;
const long double PI = acos(-1);
void bye() {
  cout << "\n";
  exit(0);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> g(n);
  for (int i = 0; i < n; i++) {
    cin >> g[i];
  }
  vector<vector<int> > dp(n, vector<int>(5, 0));
  vector<vector<int> > p(n, vector<int>(5, -1));
  for (int i = 0; i < 5; i++) {
    dp[0][i] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < 5; j++) {
      if (dp[i][j]) {
        if (g[i] == g[i + 1]) {
          for (int k = 0; k < 5; k++) {
            if (j == k) {
              continue;
            } else {
              dp[i + 1][k] = 1;
              p[i + 1][k] = j;
            }
          }
        } else if (g[i] > g[i + 1]) {
          for (int k = j - 1; k >= 0; k--) {
            dp[i + 1][k] = 1;
            p[i + 1][k] = j;
          }
        } else {
          for (int k = j + 1; k < 5; k++) {
            dp[i + 1][k] = 1;
            p[i + 1][k] = j;
          }
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i < 5; i++) {
    if (dp[n - 1][i]) {
      int v = i;
      ans.push_back(i);
      for (int j = n - 1; j > 0; j--) {
        ans.push_back(p[j][v]);
        v = p[j][v];
      }
      break;
    }
  }
  reverse((ans).begin(), ans.end());
  if (!(long long)(ans).size()) {
    cout << -1;
  } else {
    for (auto v : ans) {
      cout << v + 1 << " ";
    }
  }
  bye();
}
