#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
bool dp[N][6];
int pre[N][6];
int a[N];
vector<int> ans;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= 5; i++) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; i++) {
    if (a[i - 1] < a[i]) {
      for (int p = 1; p <= 5; p++) {
        for (int s = p + 1; s <= 5; s++) {
          if (dp[i - 1][p]) {
            dp[i][s] = 1;
            pre[i][s] = p;
          }
        }
      }
    } else if (a[i - 1] > a[i]) {
      for (int p = 1; p <= 5; p++) {
        for (int s = p - 1; s; s--) {
          if (dp[i - 1][p]) {
            dp[i][s] = 1;
            pre[i][s] = p;
          }
        }
      }
    } else {
      for (int p = 1; p <= 5; p++) {
        for (int s = 1; s <= 5; s++) {
          if (s != p && dp[i - 1][p]) {
            dp[i][s] = 1;
            pre[i][s] = p;
          }
        }
      }
    }
  }
  for (int i = 1; i <= 5; i++) {
    if (dp[n][i]) {
      int t = i;
      for (int j = n; j; j--) {
        ans.push_back(t);
        t = pre[j][t];
      }
      reverse(ans.begin(), ans.end());
      for (auto it : ans) {
        printf("%d ", it);
      }
      return 0;
    }
  }
  puts("-1");
}
