#include <bits/stdc++.h>
using namespace std;
void read() { return; }
void wrt() { cout << (string) "\n"; }
void wrt(long long t) { cout << t; }
void wrt(int t) { cout << t; }
void wrt(char t) { cout << t; }
void wrt(string t) { cout << t; }
void wrt(double t) { cout << t; }
template <class T>
void wrt(set<T> v);
template <class T>
void wrt(vector<T> v);
template <class T>
void wrt(multiset<T> v);
template <class T, class V>
void wrt(map<T, V> v);
template <class T, class V>
void wrt(pair<T, V> p);
template <size_t T>
void wrt(const char (&a)[T]) {
  string s = a;
  wrt(s);
  wrt();
}
template <class T>
void wrt(set<T> v) {
  for (T i : v) {
    wrt(i);
    wrt(' ');
  }
  wrt();
}
template <class T>
void wrt(vector<T> v) {
  for (T i : v) {
    wrt(i);
    wrt(' ');
  }
  wrt();
}
template <class T>
void wrt(multiset<T> v) {
  for (T i : v) {
    wrt(i);
    wrt(' ');
  }
  wrt();
}
template <class T, class V>
void wrt(map<T, V> v) {
  for (auto i : v) {
    wrt(i);
    wrt(' ');
  }
  wrt();
}
template <class T, class V>
void wrt(pair<T, V> p) {
  wrt(p.first);
  wrt(' ');
  wrt(p.second);
  wrt();
}
template <class T, class... V>
void wrt(T x, V... args) {
  (wrt(x), wrt(' '), wrt(args...));
}
template <class T, class... V>
void read(T &x, V &...args) {
  ((cin >> x), read(args...));
}
template <class T>
void readArr(T &arr, int x, int y) {
  for (int i = (int)x; i < (int)y; ++i) cin >> arr[i];
}
template <class T>
void wrtArr(T &arr, int x, int y) {
  for (int i = (int)x; i < (int)y; ++i) cout << arr[i] << ' ';
  wrt();
}
const int N = 2e5 + 7;
const int INF = INT_MAX;
const int MOD = 1e9 + 7;
const int dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
long long _bits(long long x) {
  long long cnt = 0;
  while (x > 0) {
    cnt++;
    x >>= 1;
  }
  return cnt;
}
long long _setbits(long long x) {
  long long cnt = 0;
  while (x > 0) {
    if (x & 1) cnt++;
    x >>= 1;
  }
  return cnt;
}
long long _gcd(long long a, long long b) {
  return (b == 0) ? (a) : (_gcd(b, a %= b));
}
long long _lcm(long long a, long long b) { return (a * b) / _gcd(a, b); }
long long _sum(vector<int> a) { return accumulate(a.begin(), a.end(), 0ll); }
long long _add(long long x, long long y) {
  x %= MOD, y %= MOD;
  return (x + y) % MOD;
}
long long _sub(long long x, long long y) {
  x %= MOD, y %= MOD;
  return (x - y + MOD) % MOD;
}
long long _mul(long long x, long long y) {
  x %= MOD, y %= MOD;
  return (x * 1ll * y) % MOD;
}
long long _pow(long long x, long long y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0) {
    long long _tmp = _pow(x, y / 2);
    return _mul(_tmp, _tmp);
  } else
    return _mul(x, _pow(x, y - 1));
}
long long _inv(long long p) { return _pow(p, MOD - 2); }
long long _div(long long x, long long y) {
  x %= MOD, y %= MOD;
  return _mul(x, _inv(y));
}
long long _nCr(long long n, long long r, vector<long long> &fact) {
  return _mul(fact[n], _inv(_mul(fact[r], fact[n - r])));
}
int n;
vector<int> a, b;
vector<vector<int> > dp;
int f(int i, int val) {
  if (i == n) return 1;
  int &ans = dp[val][i];
  if (ans != -1) return ans;
  ans = 0;
  for (int j = (int)1; j < (int)6; ++j) {
    if (a[i - 1] < a[i]) {
      if (b[i - 1] < j) b[i] = j, ans = f(i + 1, j);
    } else if (a[i - 1] > a[i]) {
      if (b[i - 1] > j) b[i] = j, ans = f(i + 1, j);
    } else {
      if (b[i - 1] != j) b[i] = j, ans = f(i + 1, j);
    }
    if (ans) return ans;
  }
  return ans;
}
void solveTestCase(int testcase) {
  read(n);
  a.assign(n, 0);
  b.assign(n, 0);
  readArr(a, 0, n);
  bool flag = false;
  for (int i = (int)1; i < (int)6; ++i) {
    dp.assign(6, vector<int>(n, -1));
    b[0] = i;
    flag = f(1, i);
    if (flag) break;
  }
  if (flag)
    wrt(b);
  else
    wrt(-1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  ;
  int t = 1;
  for (int testcase = 1; testcase <= t; testcase++) solveTestCase(testcase);
  return 0;
}
