#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> p(n);
  p[n - 1] = 0;
  for (int i = n - 2; i >= 0; i--) {
    if (a[i + 1] > a[i]) {
      p[i] = -1;
    } else if (a[i + 1] < a[i]) {
      p[i] = 1;
    } else {
      p[i] = -p[i + 1];
    }
  }
  vector<int> b(n);
  b[0] = (p[0] == -1) ? 1 : 5;
  for (int i = 1; i < n; i++) {
    if (a[i - 1] < a[i]) {
      switch (p[i]) {
        case -1:
          b[i] = b[i - 1] + 1;
          break;
        case 1:
          b[i] = 5;
          break;
        case 0:
        default:
          b[i] = b[i - 1] + 1;
          break;
      }
    }
    if (a[i - 1] > a[i]) {
      switch (p[i]) {
        case -1:
          b[i] = 1;
          break;
        case 1:
          b[i] = b[i - 1] - 1;
          break;
        case 0:
        default:
          b[i] = b[i - 1] - 1;
          break;
      }
    }
    if (a[i - 1] == a[i]) {
      switch (p[i]) {
        case -1:
          b[i] = b[i - 1] != 1 ? 1 : 2;
          break;
        case 1:
          b[i] = b[i - 1] != 5 ? 5 : 4;
          break;
        case 0:
        default:
          b[i] = 1 + (b[i - 1] % 5);
          break;
      }
    }
    if (b[i] < 1 || b[i] > 5) {
      cout << -1 << endl;
      return 0;
    }
    if (b[i] == b[i - 1]) {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}
