#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& x : a) cin >> x;
  vector<vector<int>> dp(n, vector<int>(6, -1));
  dp[0] = vector<int>(6, 1);
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < 6; j++)
      for (int k = 1; k < 6; k++) {
        if (dp[i - 1][k] > 0 &&
            ((a[i - 1] < a[i] && k < j) || (a[i - 1] > a[i] && k > j) ||
             (a[i - 1] == a[i] && k != j))) {
          dp[i][j] = k;
        }
      }
  }
  for (int i = 1; i < 6; i++)
    if (dp[n - 1][i] != -1) {
      vector<int> ans(n);
      ans[n - 1] = i;
      int prev = i;
      for (int j = n - 1; j > 0; j--) {
        prev = dp[j][prev];
        ans[j - 1] = prev;
      }
      for (auto& x : ans) cout << x << " ";
      return 0;
    }
  cout << -1;
}
