#include <bits/stdc++.h>
using namespace std;
int f[100005][6];
int a[100005];
void print(int num, int j) {
  if (num > 0) print(num - 1, f[num][j]);
  cout << j << " ";
  return;
}
int main() {
  int n;
  memset(f, 0, sizeof(f));
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= 5; i++) f[0][i] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 5; j >= 1; j--) {
      if (f[i - 1][j]) {
        if (a[i] > a[i - 1])
          for (int k = 1; j + k <= 5; k++) f[i][j + k] = j;
        else if (a[i] < a[i - 1])
          for (int k = 1; j - k >= 1; k++) f[i][j - k] = j;
        else {
          for (int k = 1; j - k >= 1; k++) f[i][j - k] = j;
          for (int k = 1; j + k <= 5; k++) f[i][j + k] = j;
        }
      }
    }
  }
  for (int i = 1; i <= 5; i++) {
    if (f[n - 1][i]) {
      print(n - 1, i);
      return 0;
    }
  }
  cout << -1;
}
