#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
int main() {
  int h, m, s, t1, t2;
  cin >> h >> m >> s >> t1 >> t2;
  double S = s * 6.0;
  double M = m * 6.0 + (s / 60.0);
  double H = h * 30.0 + (m / 10.0) + (s / 600.0);
  double T1 = t1 * 30.0;
  double T2 = t2 * 30.0;
  if (T1 + EPS >= 360.0) T1 -= 360.0;
  if (T2 + EPS >= 360.0) T2 -= 360.0;
  if (H + EPS >= 360.0) H -= 360.0;
  if (T1 > T2) swap(T1, T2);
  int cnt = 0;
  if (T1 <= S + EPS && S + EPS <= T2) ++cnt;
  if (T1 <= M + EPS && M + EPS <= T2) ++cnt;
  if (T1 <= H + EPS && H + EPS <= T2) ++cnt;
  if (cnt == 0 || cnt == 3)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
