#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[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 = 1; i < n; i++) {
    if (a[i] > a[i - 1]) {
      for (int j = 0; j < 5; j++) {
        for (int t = 0; t < j; t++) {
          if (dp[i][j] < dp[i - 1][t]) {
            p[i][j] = t;
            dp[i][j] = dp[i - 1][t];
          }
        }
      }
    } else if (a[i] < a[i - 1]) {
      for (int j = 0; j < 5; j++) {
        for (int t = j + 1; t < 5; t++) {
          if (dp[i][j] < dp[i - 1][t]) {
            p[i][j] = t;
            dp[i][j] = dp[i - 1][t];
          }
        }
      }
    } else {
      for (int j = 0; j < 5; j++) {
        for (int t = 0; t < 5; t++) {
          if (j == t) continue;
          if (dp[i][j] < dp[i - 1][t]) {
            p[i][j] = t;
            dp[i][j] = dp[i - 1][t];
          }
        }
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (dp[n - 1][i] == 1) {
      vector<int> ans = {i};
      for (int j = n - 1; j > 0; j--) {
        ans.push_back(p[j][i]);
        i = p[j][i];
      }
      for (int j = n - 1; j >= 0; j--) {
        cout << ans[j] + 1 << " ";
      }
      exit(0);
    }
  }
  cout << -1;
}
