#include <bits/stdc++.h>
using namespace std;
const long long INF = LLONG_MAX;
const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int pi = acos(-1);
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
const int N = 2e5 + 5;
const int MAXN = 1e5 + 1;
int a[N], dp[N][6], p[N][6];
vector<int> v;
void ans(int n, int val) {
  v.push_back(val);
  if (n == 1) {
    reverse(v.begin(), v.end());
    for (int i = 0; i < (int)v.size(); i++) {
      cout << v[i] << " ";
    }
    exit(0);
  }
  int to = p[n][val];
  ans(n - 1, to);
}
int main() {
  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++) {
      int w = INT_MIN;
      for (int k = 1; k <= 5; k++) {
        if (k == j) continue;
        if (a[i] > a[i - 1]) {
          if (j > k) w = max(w, dp[i - 1][k]);
        }
        if (a[i] < a[i - 1]) {
          if (j < k) w = max(w, dp[i - 1][k]);
        }
        if (a[i] == a[i - 1]) {
          w = max(w, dp[i - 1][k]);
        }
      }
      if (w == 1) {
        dp[i][j] = 1;
        int ans;
        for (int k = 1; k <= 5; k++) {
          if (k == j) continue;
          if (a[i] > a[i - 1]) {
            if (j > k) {
              if (dp[i - 1][k] == 1) {
                ans = k;
                break;
              }
            }
          } else if (a[i] < a[i - 1]) {
            if (j < k) {
              if (dp[i - 1][k] == 1) {
                ans = k;
                break;
              }
            }
          } else {
            if (dp[i - 1][k] == 1) {
              ans = k;
              break;
            }
          }
        }
        p[i][j] = ans;
      } else {
        dp[i][j] = INT_MIN;
      }
    }
  }
  for (int i = 1; i <= 5; i++) {
    if (dp[n][i] == 1) {
      ans(n, i);
      return 0;
    }
  }
  cout << -1;
}
