#include <bits/stdc++.h>
using namespace std;
void _print(long long t) { cerr << t; }
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(long double t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(unsigned long long t) { cerr << t; }
template <class T, class V>
void _print(T a[], V sz);
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << " -> ";
  _print(p.second);
  cerr << "}" << endl;
}
template <class T, class V>
void _print(T a[], V sz) {
  for (V i = 0; i < sz; i++) {
    _print(a[i]);
    cerr << " ";
  }
  cerr << endl;
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]" << endl;
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]" << endl;
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]" << endl;
}
void _printall(long long t) { cout << t; }
void _printall(int t) { cout << t; }
void _printall(string t) { cout << t; }
void _printall(char t) { cout << t; }
void _printall(long double t) { cout << t; }
void _printall(double t) { cout << t; }
void _printall(unsigned long long t) { cout << t; }
template <class T, class V>
void _printall(T a[], V sz);
template <class T, class V>
void _printall(pair<T, V> p);
template <class T>
void _printall(vector<T> v);
template <class T>
void _printall(set<T> v);
template <class T, class V>
void _printall(map<T, V> v);
template <class T>
void _printall(multiset<T> v);
template <class T, class V>
void _printall(T a[], V sz) {
  for (V i = 0; i < sz; i++) {
    _printall(a[i]);
    cout << " ";
  }
  cout << endl;
}
template <class T, class V>
void _printall(pair<T, V> p) {
  _printall(p.ff);
  cout << ",";
  _printall(p.ss);
}
template <class T>
void _printall(vector<T> v) {
  for (T i : v) {
    _printall(i);
    cout << " ";
  }
  cout << endl;
}
template <class T>
void _printall(set<T> v) {
  for (T i : v) {
    _printall(i);
    cout << " ";
  }
  cout << endl;
}
template <class T>
void _printall(multiset<T> v) {
  for (T i : v) {
    _printall(i);
    cout << " ";
  }
  cout << endl;
}
template <class T, class V>
void _printall(map<T, V> v) {
  for (auto i : v) {
    _printall(i);
    cout << " ";
  }
  cout << endl;
}
long long dp[100000][6];
vector<long long> M;
int count(long long i, long long j) {
  if (i == 0) {
    return dp[i][j] = 100;
  } else if (dp[i][j] != -1) {
    return dp[i][j];
  } else {
    if (M[i] < M[i - 1]) {
      for (int k = 5; k > j; k--) {
        if (count(i - 1, k) != 0) {
          return dp[i][j] = k;
        }
      }
      if (dp[i][j] == -1) {
        return dp[i][j] = 0;
      }
    } else if (M[i] > M[i - 1]) {
      for (int k = 1; k < j; k++) {
        if (count(i - 1, k) != 0) {
          return dp[i][j] = k;
        }
      }
      if (dp[i][j] == -1) {
        return dp[i][j] = 0;
      }
    } else {
      for (int k = 1; k <= 5; k++) {
        if (count(i - 1, k) != 0 && k != j) {
          return dp[i][j] = k;
        }
      }
      if (dp[i][j] == -1) {
        return dp[i][j] = 0;
      }
    }
  }
}
vector<long long> v1;
void trace(long long i, long long j, long long dp[][6ll]) {
  if (i == -1) {
    return;
  } else if (i == 0) {
    if (dp[i][j] == 100) {
      v1.push_back(j);
      return;
    } else {
      v1.clear();
      return;
    }
  } else if (dp[i][j] != 0 || dp[i][j] != -1) {
    v1.push_back(j);
    trace(i - 1, dp[i][j], dp);
  }
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> v;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) {
    long long k;
    cin >> k;
    v.push_back(k);
  }
  M = v;
  for (int i = 1; i <= 5; i++) {
    count(n - 1, i);
  }
  int cnt = 0;
  for (int i = 1; i <= 5; i++) {
    trace(n - 1, i, dp);
    if (v1.size() != 0) {
      break;
    }
  }
  if (v1.size() != n) {
    cout << -1 << endl;
  } else {
    reverse(v1.begin(), v1.end());
    for (int i = 0; i < n; i++) {
      cout << v1[i] << " ";
    }
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
