#include <bits/stdc++.h>
using namespace std;
int n;
int a[int(2e5) + 7];
int dp[int(2e5) + 7][6];
int ps[int(2e5) + 7][6];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  dp[1][1] = dp[1][2] = dp[1][3] = dp[1][4] = dp[1][5] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= 5; j++) {
      for (int k = 1; k <= 5; k++) {
        if (a[i - 1] < a[i]) {
          if (k < j && dp[i - 1][k]) {
            dp[i][j] = 1;
            ps[i][j] = k;
          }
        } else if (a[i - 1] > a[i]) {
          if (k > j && dp[i - 1][k]) {
            dp[i][j] = 1;
            ps[i][j] = k;
          }
        } else {
          if (k != j && dp[i - 1][k]) {
            dp[i][j] = 1;
            ps[i][j] = k;
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 5; i >= 1; i--) {
    if (dp[n][i]) {
      ans = i;
      break;
    }
  }
  if (ans == 0) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> otv;
  while (n >= 1) {
    otv.push_back(ans);
    ans = ps[n][ans];
    n--;
  }
  reverse(otv.begin(), otv.end());
  for (auto v : otv) {
    cout << v << " ";
  }
  cout << endl;
}
