#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long INF = 4 * (long long)1e18 + 7;
const long double eps = 1e-9;
signed main() {
  if (false) {
    freopen("output.txt", "w", stdout);
    freopen("input.txt", "r", stdin);
  }
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<vector<int>> dp(5, vector<int>(n, -1));
  for (int i = 0; i < 5; i++) {
    dp[i][0] = -2;
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < 5; j++) {
      if (dp[j][i] != -1) {
        if (arr[i + 1] > arr[i]) {
          for (int m = j + 1; m < 5; m++) {
            dp[m][i + 1] = j;
          }
        } else if (arr[i + 1] < arr[i]) {
          for (int m = 0; m < j; m++) {
            dp[m][i + 1] = j;
          }
        } else {
          for (int m = 0; m < 5; m++) {
            if (m == j) continue;
            dp[m][i + 1] = j;
          }
        }
      }
    }
  }
  vector<int> ans;
  for (int j = 0; j < 5; j++) {
    if (dp[j][n - 1] != -1) {
      int type = j;
      for (int i = n - 1; i >= 0; i--) {
        ans.push_back(type + 1);
        type = dp[type][i];
      }
      break;
    }
  }
  if (ans.size() == 0) {
    cout << -1 << endl;
  } else {
    for (int i = n - 1; i >= 0; i--) {
      cout << ans[i] << ' ';
    }
    cout << endl;
  }
  return 0;
}
