#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(20);
  cout << fixed;
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int &e : v) cin >> e;
  int a = 0, b = 0;
  vector<int> f(n);
  for (int i = 0; i + 1 < n; i++) {
    if (v[i] > v[i + 1]) f[i] = 1;
  }
  int l = 1;
  vector<int> t(n);
  for (int i = n - 1; i > 0; i--) {
    if (v[i] == v[i - 1]) t[i] = l;
    if (v[i] > v[i - 1])
      l = 1;
    else if (v[i] < v[i - 1])
      l = 2;
  }
  int x = 1;
  if (f[0]) x = 5;
  if (n > 1 && t[1]) x = 3;
  vector<int> ans(n);
  ans[0] = x;
  l = x;
  for (int i = 1; i < n; i++) {
    if (v[i] == v[i - 1]) {
      if (i != n - 1 && t[i + 1])
        x = 3;
      else {
        if (t[i] == 1)
          x = 1;
        else
          x = 5;
      }
    } else if (v[i] > v[i - 1])
      x++;
    else
      x--;
    if (f[i] != f[i - 1] && (i == n - 1 || !t[i + 1])) {
      if (f[i])
        x = 5;
      else
        x = 1;
    }
    if (x > 1 && x == l) x--;
    if (x < 5 && x == l) x++;
    l = x;
    ans[i] = x;
    if (ans[i] == ans[i - 1]) {
      cout << -1;
      return 0;
    }
    if (ans[i] > ans[i - 1] && v[i] < v[i - 1]) {
      cout << -1;
      return 0;
    }
    if (ans[i] < ans[i - 1] && v[i] > v[i - 1]) {
      cout << -1;
      return 0;
    }
    if (ans[i] > 5 || ans[i] < 1) {
      cout << -1;
      return 0;
    }
  }
  for (int i : ans) cout << i << " ";
}
