#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
template <class T, class U>
istream &operator>>(istream &in, pair<T, U> &p) {
  in >> p.first >> p.second;
  return in;
}
template <class T, class U>
ostream &operator<<(ostream &out, const pair<T, U> &p) {
  out << p.first << ' ' << p.second;
  return out;
}
template <class T>
istream &operator>>(istream &in, vector<T> &v) {
  for (auto &i : v) {
    in >> i;
  }
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (auto &i : v) {
    out << i << ' ';
  }
  return out;
}
inline void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
  cout << fixed << setprecision(8);
}
long long bin_pow(long long a, long long b) {
  return b == 0 ? 1 : (b % 2 ? bin_pow(a, b - 1) * a : bin_pow(a * a, b / 2));
}
bool prime(long long n) {
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
signed main() {
  io();
  int n;
  cin >> n;
  if (n == 1) {
    cout << 1;
    return 0;
  }
  vector<int> a(n);
  vector<int> ans(n);
  cin >> a;
  if (a[0] > a[1]) {
    ans[0] = 5;
  } else
    ans[0] = 1;
  for (int i = 1; i < n - 1; ++i) {
    if (a[i - 1] < a[i] && a[i] > a[i + 1])
      ans[i] = 5;
    else if (a[i - 1] > a[i] && a[i] < a[i + 1])
      ans[i] = 1;
    else if (a[i - 1] > a[i] && a[i] > a[i + 1])
      ans[i] = ans[i - 1] - 1;
    else if (a[i - 1] < a[i] && a[i] < a[i + 1])
      ans[i] = ans[i - 1] + 1;
    else if (a[i - 1] == a[i] && a[i] > a[i + 1]) {
      if (ans[i - 1] == 5)
        ans[i] = 4;
      else
        ans[i] = 5;
    } else if (a[i - 1] == a[i] && a[i] < a[i + 1]) {
      if (ans[i - 1] == 1)
        ans[i] = 2;
      else
        ans[i] = 1;
    } else if (a[i - 1] < a[i] && a[i] == a[i + 1])
      ans[i] = ans[i - 1] + 1;
    else if (a[i - 1] > a[i] && a[i] == a[i + 1])
      ans[i] = ans[i - 1] - 1;
    else if (a[i - 1] == a[i] && a[i] == a[i + 1]) {
      if (ans[i - 1] == 3)
        ans[i] = 2;
      else
        ans[i] = 3;
    }
  }
  if (a[n - 2] < a[n - 1]) ans[n - 1] = ans[n - 2] + 1;
  if (a[n - 2] > a[n - 1]) ans[n - 1] = ans[n - 2] - 1;
  if (a[n - 2] == a[n - 1]) ans[n - 1] = max(1, 5 - ans[n - 2]);
  for (int i = 0; i < n; ++i) {
    if (ans[i] < 1 || ans[i] > 5) {
      cout << -1;
      return 0;
    } else if (i > 0 && ans[i] == ans[i - 1]) {
      cout << -1;
      return 0;
    }
  }
  cout << ans << '\n';
  return 0;
}
