#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n), ans;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n == 1) {
    cout << 1 << endl;
    return;
  }
  if (a[0] > a[1]) ans.push_back(5);
  if (a[0] < a[1]) ans.push_back(1);
  if (a[0] == a[1]) ans.push_back(3);
  for (long long i = 0; i < n - 1; i++) {
    if (a[i] < a[i + 1] && ans[i] == 5) {
      cout << -1;
      return;
    }
    if (a[i] > a[i + 1] && ans[i] == 1) {
      cout << -1;
      return;
    }
    long long dop = 0;
    if (a[i] < a[i + 1]) {
      dop = ans[i] + 1;
      if (i < n - 2) {
        if (a[i + 1] > a[i + 2]) dop = 5;
      }
    }
    if (a[i] > a[i + 1]) {
      dop = ans[i] - 1;
      if (i < n - 2) {
        if (a[i + 1] < a[i + 2]) dop = 1;
      }
    }
    if (a[i] == a[i + 1]) {
      dop = (ans[i] == 3 ? 2 : 3);
      if (i < n - 2) {
        if (a[i + 1] < a[i + 2]) dop = (ans[i] == 1 ? 2 : 1);
        if (a[i + 1] > a[i + 2]) dop = (ans[i] == 5 ? 4 : 5);
      }
    }
    ans.push_back(dop);
  }
  for (auto i : ans) {
    cout << i << " ";
  }
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long double t = 1;
  while (t--) {
    solve();
  }
}
