#include <bits/stdc++.h>
using namespace std;
int a[100001][5] = {0};
int note[100001];
vector<int> v;
int print(int n) {
  int pre;
  for (int i = 0; i < 5; i++) {
    if (a[n - 1][i]) {
      v.push_back(i + 1);
      pre = a[n - 1][i];
      for (int j = n - 2; j >= 0; j--) {
        v.push_back(pre);
        pre = a[j][pre - 1];
      }
      return 1;
    }
  }
  return 0;
}
int main() {
  int n, pre;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> note[i];
  }
  for (int i = 0; i < 5; i++) {
    a[0][i] = i + 1;
  }
  for (int i = 1; i < n; i++) {
    if (note[i] < note[i - 1]) {
      for (int j = 0; j < 5; j++) {
        for (int k = 4; k > j; k--) {
          if (a[i - 1][k]) {
            a[i][j] = k + 1;
          }
        }
      }
    } else if (note[i] > note[i - 1]) {
      for (int j = 0; j < 5; j++) {
        for (int k = 0; k < j; k++) {
          if (a[i - 1][k]) {
            a[i][j] = k + 1;
          }
        }
      }
    } else {
      for (int j = 0; j < 5; j++) {
        for (int k = 0; k < 5; k++) {
          if (a[i - 1][k] && j != k) {
            a[i][j] = k + 1;
          }
        }
      }
    }
  }
  if (print(n)) {
    reverse(v.begin(), v.end());
    for (int i = 0; i < v.size(); i++) {
      cout << v[i] << " ";
    }
    cout << endl;
  } else {
    cout << "-1" << endl;
  }
}
