#include <bits/stdc++.h>
int main() {
  int h, m, s, t1, t2;
  std::cin >> h >> m >> s >> t1 >> t2;
  if (h == 12) {
    h = 0;
  }
  if (t1 == 12) {
    t1 = 0;
  }
  if (t2 == 12) {
    t2 = 0;
  }
  std::vector<double> t;
  t.push_back((h * 3600 + m * 60 + s) / (12.0 * 3600));
  t.push_back((m * 60 + s) / (60.0 * 60));
  t.push_back((s) / (60.0));
  std::sort(t.begin(), t.end());
  double tt1 = t1 / 12.0;
  double tt2 = t2 / 12.0;
  int dt1, dt2;
  if (tt1 <= t[0] || tt1 >= t[2]) {
    dt1 = 1;
  }
  if (tt1 >= t[0] && tt1 <= t[1]) {
    dt1 = 2;
  }
  if (tt1 >= t[1] && tt1 <= t[2]) {
    dt1 = 3;
  }
  if (tt2 <= t[0] || tt2 >= t[2]) {
    dt2 = 1;
  }
  if (tt2 >= t[0] && tt2 <= t[1]) {
    dt2 = 2;
  }
  if (tt2 >= t[1] && tt2 <= t[2]) {
    dt2 = 3;
  }
  if (dt1 == dt2) {
    std ::cout << "YES";
  } else {
    std ::cout << "NO";
  }
}
