#include <bits/stdc++.h>
using namespace std;
int a[100020];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = int(0); i < int(n); ++i) cin >> a[i];
  if (n == 1) {
    cout << 3 << endl;
    return 0;
  }
  vector<int> ans;
  if (a[0] == a[1]) ans.push_back(3);
  if (a[0] < a[1]) ans.push_back(1);
  if (a[0] > a[1]) ans.push_back(5);
  for (int i = 0; i < n - 1; ++i) {
    if (a[i + 1] > a[i] and ans[i] == 5) {
      cout << -1 << endl;
      return 0;
    }
    if (a[i + 1] < a[i] and ans[i] == 1) {
      cout << -1 << endl;
      return 0;
    }
    int cur;
    if (a[i + 1] > a[i]) {
      cur = ans[i] + 1;
      if (i < n - 2) {
        if (a[i + 2] < a[i + 1]) cur = 5;
      }
    } else if (a[i + 1] < a[i]) {
      cur = ans[i] - 1;
      if (i < n - 2) {
        if (a[i + 2] > a[i + 1]) cur = 1;
      }
    } else if (a[i + 1] == a[i]) {
      cur = (ans[i] == 3) ? 2 : 3;
      if (i < n - 2) {
        if (a[i + 2] > a[i + 1]) cur = (ans[i] == 1) ? 2 : 1;
        if (a[i + 2] < a[i + 1]) cur = (ans[i] == 5) ? 4 : 5;
      }
    }
    ans.push_back(cur);
  }
  for (int x : ans) cout << x << " ";
  cout << endl;
  return 0;
}
