#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
int dp[1000010][6];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= 5; i++) dp[0][i] = i;
  for (int i = 1; i < n; i++) {
    if (a[i] > a[i - 1]) {
      for (int j = 1; j <= 5; j++) {
        for (int k = 1; k < j; k++) {
          if (dp[i - 1][k] != -1) {
            dp[i][j] = k;
            break;
          }
        }
      }
    } else if (a[i] < a[i - 1]) {
      for (int j = 1; j <= 5; j++) {
        for (int k = j + 1; k <= 5; k++) {
          if (dp[i - 1][k] != -1) {
            dp[i][j] = k;
            break;
          }
        }
      }
    } else {
      for (int j = 1; j <= 5; j++) {
        for (int k = 1; k <= 5; k++) {
          if (j != k && dp[i - 1][k] != -1) {
            dp[i][j] = k;
            break;
          }
        }
      }
    }
  }
  vector<int> pos;
  int ans = -1;
  for (int i = 1; i <= 5; i++) {
    if (dp[n - 1][i] != -1) {
      ans = i;
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= 5; j++) {
    }
  }
  if (ans != -1) {
    pos.push_back(ans);
    for (int i = n - 1; i >= 1; i--) {
      pos.push_back(dp[i][ans]);
      ans = dp[i][ans];
    }
    for (int i = pos.size() - 1; i >= 0; i--) {
      cout << pos[i] << " ";
    }
  } else
    cout << -1;
}
