#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 7;
vector<int> res, ans, a(MAX);
int flag, n;
vector<vector<int> > dp(MAX, vector<int>(6, -1));
void solve(int i, int last) {
  if (i == n) {
    flag = 1;
    ans = res;
    return;
  }
  if (dp[i][last] != -1) return;
  dp[i][last] = 1;
  if (a[i] > a[i - 1]) {
    if (last == 5) return;
    for (int j = last + 1; j <= 5; j++) {
      res.push_back(j);
      solve(i + 1, j);
      res.pop_back();
    }
  } else if (a[i] < a[i - 1]) {
    if (last == 1) return;
    for (int j = last - 1; j >= 1; j--) {
      res.push_back(j);
      solve(i + 1, j);
      res.pop_back();
    }
  } else
    for (int j = 1; j <= 5; j++)
      if (last != j) {
        res.push_back(j);
        solve(i + 1, j);
        res.pop_back();
      }
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) return cout << 1 << '\n', 0;
  int f = 0;
  for (int i = 1; i <= 5; i++) {
    res.clear();
    res.push_back(i);
    flag = 0;
    solve(1, i);
    if (flag) break;
  }
  if (!flag)
    cout << -1 << '\n';
  else
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
