#include <bits/stdc++.h>
using namespace std;
int s[93];
int main() {
  int n;
  cin >> n;
  bool bo;
  if (n == 1) {
    int x;
    cin >> x;
    if (x == 0)
      cout << "UP";
    else if (x == 15)
      cout << "DOWN";
    else
      cout << -1;
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    if ((s[i] > 15) || (s[1] < 0)) {
      cout << -1;
      return 0;
    }
    if (i == 1) continue;
    if (i == 2) {
      if (s[2] > s[1]) bo = 1;
      if (s[2] == s[1]) {
        cout << -1;
        return 0;
      }
      if (s[2] < s[1]) bo = 0;
    }
    if (bo)
      if (s[i] - s[i - 1] != 1) {
        cout << -1;
        return 0;
      }
    if (!bo) {
      if (s[i] - s[i - 1] != -1) {
        cout << -1;
        return 0;
      }
    }
    if (s[i] == 15) bo = 0;
    if (s[i] == 0) bo = 1;
  }
  if (s[n] == 15)
    cout << "DOWN";
  else if (s[n] == 0)
    cout << "UP";
  else if (s[n] > s[n - 1])
    cout << "UP";
  else
    cout << "DOWN";
  return 0;
}
