#include <bits/stdc++.h>
using namespace std;
int h, m, s, st, endd;
bool f = 0;
int main() {
  cin >> h >> m >> s;
  cin >> st >> endd;
  st %= 12;
  st *= 5;
  int offset = 60 - st;
  endd %= 12;
  endd *= 5;
  endd += offset;
  endd %= 60;
  h %= 12;
  h *= 5;
  h += offset;
  h %= 60;
  if (m || s) h++;
  m += offset;
  if (s) {
    if (m != 59) {
      m++;
      f = true;
    }
  }
  m %= 60;
  s += offset;
  s %= 60;
  if ((h <= endd && m <= endd && s <= endd)) {
    puts("YES");
    return 0;
  }
  if (f) {
    if (m == 0) m = 60;
    m--;
  }
  if ((h >= endd && m >= endd && s >= endd))
    puts("YES");
  else {
    puts("NO");
  }
  return 0;
}
