#include <bits/stdc++.h>
using namespace std;
int n, a[100005], dp[100005][5];
bool solve(int i, int j) {
  if (i == n - 1) return true;
  if (dp[i][j] == -1) {
    bool ans = false;
    if (a[i] < a[i + 1])
      for (int k = j + 1; k < 5; k++) ans |= solve(i + 1, k);
    else if (a[i] > a[i + 1])
      for (int k = 0; k < j; k++) ans |= solve(i + 1, k);
    else
      for (int k = 0; k < 5; k++)
        if (j != k) ans |= solve(i + 1, k);
    dp[i][j] = ans;
  }
  return dp[i][j];
}
void print(int i, int j) {
  cout << j + 1 << " ";
  if (i == n - 1) {
    cout << endl;
    return;
  }
  if (a[i] < a[i + 1]) {
    for (int k = j + 1; k < 5; k++) {
      if (solve(i + 1, k)) {
        print(i + 1, k);
        return;
      }
    }
  } else if (a[i] > a[i + 1]) {
    for (int k = 0; k < j; k++) {
      if (solve(i + 1, k)) {
        print(i + 1, k);
        return;
      }
    }
  } else {
    for (int k = 0; k < 5; k++) {
      if (j != k && solve(i + 1, k)) {
        print(i + 1, k);
        return;
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  memset(dp, -1, sizeof(dp));
  for (int j = 0; j < 5; j++) {
    if (solve(0, j)) {
      print(0, j);
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
