#include <bits/stdc++.h>
using namespace std;
long long n, a[100005], dp[100005][6];
bool flag = false;
long long func(long long index, long long prev) {
  if (index == n + 1) {
    flag = true;
    dp[n + 1][prev] = 1;
    return 1;
  }
  if (dp[index][prev] != -1) return dp[index][prev];
  long long c = 0;
  if (a[index - 1] < a[index] && !flag) {
    for (long long i = prev + 1; i <= 5 && !flag; i++) {
      if (func(index + 1, i) == 1) dp[index][prev] = 1;
      c++;
    }
  } else if (a[index - 1] > a[index] && !flag) {
    for (long long i = 1; i < prev && !flag; i++) {
      if (func(index + 1, i) == 1) dp[index][prev] = 1;
      c++;
    }
  } else if (!flag) {
    for (long long i = 1; i <= 5 && !flag; i++) {
      if (i != prev && func(index + 1, i) == 1) {
        dp[index][prev] = 1;
        c++;
      }
    }
  }
  if (!c || dp[index][prev] == -1) dp[index][prev] = 0;
  return dp[index][prev];
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= 5; i++) {
    if (!flag) func(2, i);
  }
  if (flag) {
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= 5; j++) {
        if (dp[i + 1][j] == 1) {
          cout << j << " ";
          break;
        }
      }
    }
  } else
    cout << -1;
  return 0;
}
