#include <bits/stdc++.h>
using namespace std;
double mi, ho, se;
int main() {
  int h, m, s, t1, t2;
  scanf("%d", &h), scanf("%d", &m);
  scanf("%d", &s), scanf("%d", &t1);
  scanf("%d", &t2);
  h *= 5;
  h %= 60;
  t1 *= 5;
  t1 %= 60;
  t2 *= 5;
  t2 %= 60;
  ho = h + m / 60.0 + s / 360.0;
  mi = m + s / 60.0;
  se = s;
  int st = t1;
  for (int i = 0; i < 61; i++) {
    if (st == t2) {
      printf("YES\n");
      return 0;
    } else {
      if ((st <= ho && (st + 1) % 60 >= ho) ||
          (st <= mi && (st + 1) % 60 >= mi) ||
          (st <= se && (st + 1) % 60 >= se))
        break;
    }
    st += 1;
    st %= 60;
  }
  st = t1;
  for (int i = 0; i < 61; i++) {
    if (st == t2) {
      printf("YES\n");
      return 0;
    } else {
      if ((st >= ho && ((st - 1) < 0 ? st - 1 + 60 : st - 1) <= ho) ||
          (st >= mi && ((st - 1) < 0 ? st - 1 + 60 : st - 1) <= mi) ||
          (st >= se && ((st - 1) < 0 ? st - 1 + 60 : st - 1) <= se))
        break;
    }
    st -= 1;
    if (st < 0) st += 60;
  }
  printf("NO\n");
  return 0;
}
