#include <bits/stdc++.h>
using namespace std;
int v[200005];
int n;
int dp[200005][10];
int back(int posi, int last) {
  if (posi == n - 1) return dp[posi][last] = 1;
  if (dp[posi][last] == -1) return -1;
  if (dp[posi][last] != 0) return 1;
  if (v[posi] < v[posi + 1]) {
    for (int i = last + 1; i <= 5; i++) {
      if (back(posi + 1, i) != -1) {
        return dp[posi][last] = i;
      }
    }
    return dp[posi][last] = -1;
  } else if (v[posi] > v[posi + 1]) {
    for (int i = last - 1; i > 0; i--) {
      if (back(posi + 1, i) != -1) {
        return dp[posi][last] = i;
      }
    }
    return dp[posi][last] = -1;
  } else {
    for (int i = 1; i <= 5; i++)
      if (i != last) {
        if (back(posi + 1, i) != -1) {
          return dp[posi][last] = i;
        }
      }
    return dp[posi][last] = -1;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin >> n;
  int percurat = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int last;
  for (int i = 1; i <= 5; i++) {
    last = i;
    back(0, i);
    if (dp[0][last] != -1) break;
  }
  vector<int> resp;
  resp.push_back(last);
  for (int i = 0; i < n - 1; i++) {
    if (last == -1) break;
    resp.push_back(dp[i][last]);
    last = dp[i][last];
  }
  if (resp.size() != n)
    cout << -1;
  else
    for (int i = 0; i < n; i++) cout << resp[i] << " ";
  cout << endl;
  return 0;
}
