#include <bits/stdc++.h>
using namespace std;
int h, m, s;
double x[3];
int get(double t) {
  int X = -1;
  for (int i = 0; i < 3; i++) {
    int j = (i == 2 ? 0 : i + 1);
    if (x[i] < x[j]) {
      if (t >= x[i] && t < x[j]) X = i;
    } else {
      if ((t >= x[i] && t <= 360.0) || (t >= 0 && t <= x[j])) X = i;
    }
  }
  return X;
}
double t1, t2;
int main() {
  cin >> h >> m >> s >> t1 >> t2;
  double ht, mt, st;
  st = s * 6.0;
  mt = m * 6.0 + st / 60.0;
  ht = h * 30.0 + mt / 12.0;
  t1 *= 30.0;
  t2 *= 30.0;
  x[0] = st;
  x[1] = mt;
  x[2] = ht;
  for (int i = 0; i < 3; i++)
    if (x[i] > 360.0) x[i] -= 360.0;
  sort(x, x + 3);
  if (get(t1) == get(t2)) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
