#include <bits/stdc++.h>
using namespace std;
int h, m, s, p1, in1, p2, in2;
double pos[233];
int where(int x) {
  x %= 12;
  double t = (double)360 * x / 12;
  for (int i = 1; i < 3; i++) {
    if (pos[i] < t && t < pos[i + 1]) return i;
  }
  return 3;
}
int main() {
  cin >> h >> m >> s >> p1 >> p2;
  h %= 12;
  pos[1] = (double)360 * s / 60;
  pos[2] = (double)360 * m / 60 + (double)360 * s / 60 / 60;
  pos[3] = (double)360 * h / 12 + (double)360 * m / 12 / 60 +
           (double)360 * s / 12 / 60 / 60;
  sort(pos + 1, pos + 4);
  in1 = where(p1);
  in2 = where(p2);
  puts(in1 == in2 ? "YES" : "NO");
}
