#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& x : a) cin >> x;
  vector<vector<bool>> dp(n, vector<bool>(5));
  vector<vector<int>> prev(n, vector<int>(5, -1));
  dp[0] = vector<bool>(5, true);
  for (int i = (0); i < (n - 1); ++i) {
    for (int j = (0); j < (5); ++j) {
      if (dp[i][j]) {
        if (a[i + 1] > a[i]) {
          for (int k = (j + 1); k < (5); ++k) {
            dp[i + 1][k] = true;
            prev[i + 1][k] = j + 1;
          }
        } else if (a[i + 1] < a[i]) {
          for (int k = (0); k < (j); ++k) {
            dp[i + 1][k] = true;
            prev[i + 1][k] = j + 1;
          }
        } else {
          for (int k = (0); k < (5); ++k) {
            if (k != j) {
              dp[i + 1][k] = true;
              prev[i + 1][k] = j + 1;
            }
          }
        }
      }
    }
  }
  bool ok = false;
  for (int i = (0); i < (5); ++i) {
    if (dp[n - 1][i]) {
      ok = true;
      int row = n - 1;
      int col = i;
      vector<int> answer;
      answer.push_back(col + 1);
      while (prev[row][col] != -1) {
        answer.push_back(prev[row][col]);
        col = prev[row][col] - 1;
        row = row - 1;
      }
      assert(answer.size() == n);
      reverse((answer).begin(), (answer).end());
      for (auto& x : answer) cout << x << ' ';
      cout << endl;
      return 0;
    }
  }
  if (!ok) {
    cout << -1 << endl;
  }
}
