#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
int a[N];
int dp[N][6];
int pre[N][6];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= 5; i++) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= 5; j++) {
      if (a[i] > a[i - 1]) {
        for (int k = j + 1; k <= 5; k++) {
          if (dp[i - 1][j]) {
            dp[i][k] = 1;
            pre[i][k] = j;
          }
        }
      } else if (a[i] < a[i - 1]) {
        for (int k = j - 1; k > 0; k--) {
          if (dp[i - 1][j]) {
            dp[i][k] = 1;
            pre[i][k] = j;
          }
        }
      } else if (a[i] == a[i - 1]) {
        for (int k = 1; k <= 5; k++) {
          if (k == j) continue;
          if (dp[i - 1][j]) {
            dp[i][k] = 1;
            pre[i][k] = j;
          }
        }
      }
    }
  }
  for (int i = 1; i <= 5; i++) {
    if (dp[n][i]) {
      vector<int> v;
      int k = n;
      for (int j = i; j; j = pre[k][j], k--) {
        v.push_back(j);
      }
      reverse(v.begin(), v.end());
      for (auto &x : v) {
        cout << x << " ";
      }
      return 0;
    }
  }
  cout << "-1" << endl;
  return 0;
}
