#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  if (n == 1 && arr[0] == 0) {
    cout << "UP";
    return 0;
  } else if (n == 1 && arr[0] == 15) {
    cout << "DOWN";
    return 0;
  } else if (n == 1 && arr[0] != 0) {
    cout << "-1";
    return 0;
  }
  if (arr[n - 1] - arr[n - 2] == 1) {
    if (arr[n - 1] < 15)
      cout << "UP";
    else if (arr[n - 1] == 15)
      cout << "DOWN";
  } else if (arr[n - 1] - arr[n - 2] == -1) {
    if (arr[n - 1] > 0)
      cout << "DOWN";
    else if (arr[n - 1] == 0)
      cout << "UP";
  } else
    cout << "-1";
  return 0;
}
