#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
const long double eps = 0.0000000001;
const long long INF = 0x3fffffffffffffff;
long long n, a[200005], from[200005][10];
bool dp[200005][10];
void print(long long pos, long long c) {
  if (pos > 1) {
    print(pos - 1, from[pos][c]);
  }
  cout << c << ' ';
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (long long i = 1; i <= 5; ++i) {
    dp[1][i] = true;
  }
  for (long long i = 2; i <= n; ++i) {
    for (long long j = 1; j <= 5; ++j) {
      if (a[i] == a[i - 1]) {
        for (long long k = 1; k <= 5; ++k) {
          if (j != k && dp[i - 1][k]) {
            dp[i][j] = true;
            from[i][j] = k;
          }
        }
      }
      if (a[i] < a[i - 1]) {
        for (long long k = 1; k <= 5; ++k) {
          if (j < k && dp[i - 1][k]) {
            dp[i][j] = true;
            from[i][j] = k;
          }
        }
      }
      if (a[i] > a[i - 1]) {
        for (long long k = 1; k <= 5; ++k) {
          if (j > k && dp[i - 1][k]) {
            dp[i][j] = true;
            from[i][j] = k;
          }
        }
      }
    }
  }
  for (long long i = 1; i <= 5; ++i) {
    if (dp[n][i]) {
      print(n, i);
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
