#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  a[0] = a[1];
  vector<vector<int>> dp(n + 1, vector<int>(6, -1));
  for (int i = 1; i <= 5; i++) {
    dp[0][i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 5; j++) {
      for (int k = 1; k <= 5; k++) {
        if (k == j) continue;
        if (dp[i - 1][k] == -1) continue;
        if (k < j && a[i - 1] <= a[i]) dp[i][j] = k;
        if (k > j && a[i - 1] >= a[i]) dp[i][j] = k;
      }
    }
  }
  for (int i = 1; i <= 5; ++i) {
    int pr = i;
    vector<int> ans;
    for (int j = n; j > 0; --j) {
      if (pr == -1) {
        ans = {};
        break;
      }
      ans.push_back(pr);
      pr = dp[j][pr];
    }
    if (ans.size() > 0) {
      reverse(ans.begin(), ans.end());
      for (int i = 0; i < n; ++i) {
        cout << ans[i] << ' ';
      }
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
