#include <bits/stdc++.h>
const long long mod = 1000 * 1000 * 1000 + 7;
const long long mod1 = 998244353;
const long long INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
using namespace std;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (long long)(res * x);
    y = y >> 1;
    if (x <= 100000000) x = (long long)(x * x);
  }
  return res;
}
long long dp[100005][6];
long long pos[100005][6];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n + 1];
  for (int(i) = (1); (i) < (n + 1); ++(i)) cin >> a[i];
  for (int i = 1; i <= 5; i++) dp[1][i] = 1;
  for (int i = 1; i <= 5; i++) pos[1][i] = -1;
  for (int i = 1; i <= n - 1; i++) {
    if (a[i + 1] > a[i]) {
      for (int j = 1; j <= 4; j++) {
        for (int k = j + 1; k <= 5; k++) {
          if (dp[i][j]) {
            dp[i + 1][k] = 1;
            pos[i + 1][k] = j;
          }
        }
      }
    } else if (a[i + 1] < a[i]) {
      for (int j = 5; j >= 2; j--) {
        for (int k = j - 1; k >= 1; k--) {
          if (dp[i][j]) {
            dp[i + 1][k] = 1;
            pos[i + 1][k] = j;
          }
        }
      }
    } else {
      for (int j = 1; j <= 5; j++) {
        for (int k = 1; k <= 5; k++) {
          if (dp[i][j] == 1 and j != k) {
            dp[i + 1][k] = 1;
            pos[i + 1][k] = j;
          }
        }
      }
    }
  }
  long long f = 0;
  long long ed;
  for (int i = 1; i <= 5; i++) {
    if (dp[n][i]) {
      f = 1;
      ed = i;
    }
  }
  if (!f)
    cout << -1;
  else {
    vector<long long> b;
    b.push_back(ed);
    long long cur = n;
    while (ed != -1) {
      ed = pos[cur][ed];
      b.push_back(ed);
      cur -= 1;
    }
    reverse(b.begin(), b.end());
    for (int(i) = (1); (i) < (int((b).size())); ++(i)) cout << b[i] << ' ';
  }
  return 0;
}
