#include <bits/stdc++.h>
int cicle[300] = {0,  1,  2,  3,  4,  5,  6, 7, 8, 9, 10, 11, 12, 13, 14,
                  15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,  4,  3,  2,  1,
                  0,  1,  2,  3,  4,  5,  6, 7, 8, 9, 10, 11, 12, 13, 14,
                  15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,  4,  3,  2,  1,
                  0,  1,  2,  3,  4,  5,  6, 7, 8, 9, 10, 11, 12, 13, 14,
                  15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,  4,  3,  2,  1,
                  0,  1,  2,  3,  4,  5,  6, 7, 8, 9, 10, 11, 12, 13, 14,
                  15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,  4,  3,  2,  1};
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    int b;
    scanf("%d", &b);
    if (b == 15)
      printf("DOWN\n");
    else if (b == 0) {
      printf("UP\n");
    } else
      printf("-1\n");
    return 0;
  }
  int a[n];
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < 100; ++i) {
    if (a[n - 1] == cicle[i + 1] && a[n - 2] == cicle[i]) {
      if (cicle[i + 2] > cicle[i + 1])
        printf("UP\n");
      else
        printf("DOWN\n");
      return 0;
    }
  }
  return 0;
}
