#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
int a[MAX_N];
vector<int> ans;
bool check() { return ans.size() < 2 || ans.back() != ans[ans.size() - 2]; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int trend = 0, oldtrend = 0;
  for (int i = 0; i < n; ++i) {
    oldtrend = trend;
    if (i != 0) {
      if (a[i - 1] < a[i])
        trend = 1;
      else if (a[i - 1] == a[i])
        trend = 0;
      else
        trend = 2;
    }
    if (trend == 0) {
      if (i == 0)
        ans.push_back(4);
      else if (ans.back() != 3)
        ans.push_back(3);
      else
        ans.push_back(4);
    } else if (trend == 1) {
      if (oldtrend != 1) {
        ans.pop_back();
        ans.push_back(1);
        if (!check()) {
          ans.pop_back();
          ans.push_back(2);
        }
      }
      ans.push_back(ans[ans.size() - 1] + 1);
      if (ans.back() > 5) return cout << "-1", 0;
    } else {
      if (oldtrend != 2) {
        ans.pop_back();
        ans.push_back(5);
        if (!check()) {
          ans.pop_back();
          ans.push_back(4);
        }
      }
      ans.push_back(ans[ans.size() - 1] - 1);
      if (ans.back() < 1) return cout << "-1", 0;
    }
  }
  for (int u : ans) cout << u << " ";
  cout << "\n";
  return 0;
}
