#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
bool Max(T1& a, T2 b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T1, typename T2>
bool Min(T1& a, T2 b) {
  return a > b ? a = b, 1 : 0;
}
const int N = 1000, inf = 10000;
string a[N];
int htos(int h, int m, int s) {
  if (h == 12) h = 0;
  return h * 3600 + m * 60 + s;
}
int mtos(int m, int s) { return m * 12 * 60 + s * 12; }
void solve() {
  int t1, t2;
  int h[3];
  cin >> h[0] >> h[1] >> h[2] >> t1 >> t2;
  h[0] = htos(h[0], h[1], h[2]);
  t1 = htos(t1, 0, 0);
  t2 = htos(t2, 0, 0);
  h[1] = mtos(h[1], h[2]);
  h[2] = mtos(h[2], 0);
  if (t1 > t2) swap(t1, t2);
  bool ok = 1;
  for (int i = 0; i < (3); ++i)
    if (h[i] >= t1 && h[i] <= t2) ok = 0;
  if (ok) {
    cout << "YES" << '\n';
    return;
  }
  ok = 1;
  for (int i = 0; i < (3); ++i)
    if (h[i] <= t1 || h[i] >= t2) ok = 0;
  if (ok)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
void init() {}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  init();
  int TC = 1;
  for (int TI = 1; TI <= (TC); ++TI) {
    solve();
  }
  return 0;
}
