#include <bits/stdc++.h>
using namespace std;
int dp[100002][7], a[100002];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= 5; j++) {
      dp[i][j] = -1;
    }
  }
  for (int i = 2; i <= n; i++) {
    for (int l = 1; l <= 5; l++) {
      if (a[i] > a[i - 1]) {
        for (int j = 1; j < l; j++) {
          if (dp[i - 1][j] != -1) {
            dp[i][l] = j;
            break;
          }
        }
      }
      if (a[i] < a[i - 1]) {
        for (int j = 5; j > l; j--) {
          if (dp[i - 1][j] != -1) {
            dp[i][l] = j;
            break;
          }
        }
      }
      if (a[i] == a[i - 1]) {
        for (int j = 1; j <= 5; j++) {
          if (j != l && dp[i - 1][j] != -1) {
            dp[i][l] = j;
            break;
          }
        }
      }
    }
  }
  for (int i = 1; i < 6; i++) {
    if (dp[n][i] != -1) {
      vector<int> ans;
      ans.push_back(i);
      int k = i;
      for (int j = n; j >= 2; j--) {
        k = dp[j][k];
        ans.push_back(k);
      }
      reverse(ans.begin(), ans.end());
      for (auto j : ans) cout << j << " ";
      return 0;
    }
  }
  cout << -1;
  return 0;
}
