#include <bits/stdc++.h>
using namespace std;
int N;
int a[100005];
int dp[100005][5];
vector<int> ans;
bool valid(int a1, int a2, int b1, int b2) {
  if (a1 < a2) return b1 < b2;
  if (a1 > a2) return b1 > b2;
  return b1 != b2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  for (int i = 0; i < N; ++i) fill(dp[i], dp[i] + 5, -1);
  fill(dp[0], dp[0] + 5, 1);
  for (int i = 1; i < N; ++i) {
    for (int j = 0; j < 5; ++j) {
      for (int k = 0; k < 5; ++k) {
        if (dp[i - 1][k] != -1 && valid(a[i - 1], a[i], k, j)) {
          dp[i][j] = k;
        }
      }
    }
  }
  int curB = -1;
  for (int j = 0; j < 5; ++j)
    if (dp[N - 1][j] != -1) curB = j;
  if (curB == -1) {
    cout << -1 << "\n";
    return 0;
  }
  for (int i = N - 1; i >= 0; --i) {
    ans.push_back(curB);
    curB = dp[i][curB];
  }
  for (int i = N - 1; i >= 0; --i) {
    cout << ans[i] + 1 << " ";
  }
  cout << "\n";
  return 0;
}
