#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const double eps = 1e-8;
bool order(double a, double b, double c) { return a < b && b < c; }
int main() {
  double h, m, s, t1, t2;
  cin >> h >> m >> s >> t1 >> t2;
  s /= 60;
  m = m / 60 + s / 60;
  h = h / 12 + m / 12;
  if (m >= 1 - eps) m -= 1;
  if (h >= 1 - eps) h -= 1;
  t1 /= 12;
  t2 /= 12;
  if (t1 >= 1 - eps) t1 -= 1;
  if (t2 >= 1 - eps) t2 -= 1;
  if (t1 > t2) swap(t1, t2);
  bool should = order(t1, h, t2);
  if (should == order(t1, m, t2) && should == order(t1, s, t2))
    puts("YES");
  else
    puts("NO");
}
