#include <bits/stdc++.h>
using namespace std;
long long int INF = 1e9 + 5;
long long int mod = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (auto &ele : a) {
    cin >> ele;
  }
  vector<vector<long long int>> dp(n, vector<long long int>(6, -1));
  for (long long int no = 1; no <= 5; ++no) {
    dp[0][no] = 0;
  }
  for (long long int i = 1; i < n; i++) {
    for (long long int no = 1; no <= 5; ++no) {
      for (long long int prev = 1; prev <= 5; ++prev) {
        if (a[i - 1] < a[i]) {
          if (prev < no && dp[i - 1][prev] != -1) {
            dp[i][no] = prev;
            break;
          }
        } else if (a[i - 1] > a[i]) {
          if (prev > no && dp[i - 1][prev] != -1) {
            dp[i][no] = prev;
            break;
          }
        } else {
          if (no != prev && dp[i - 1][prev] != -1) {
            dp[i][no] = prev;
            break;
          }
        }
      }
    }
  }
  long long int last = -1;
  for (long long int no = 1; no <= 5; ++no) {
    if (dp[n - 1][no] != -1) {
      last = no;
      break;
    }
  }
  if (last == -1) {
    cout << last << "\n";
    return 0;
  }
  long long int index = n - 1;
  stack<long long int> st;
  while (last) {
    st.push(last);
    last = dp[index--][last];
  }
  while (!st.empty()) {
    cout << st.top() << " ";
    st.pop();
  }
  cout << "\n";
}
