#include <bits/stdc++.h>
using namespace std;
long long H, M, S, T1, T2;
long double h, m, s, t1, t2;
void solve() {
  cin >> H >> M >> S >> T1 >> T2;
  h = (H % 12) * 5;
  if (M || S) h += .5;
  m = M;
  if (S) m += .5;
  s = S;
  t1 = (T1 % 12) * 5, t2 = (T2 % 12) * 5;
  if (t1 == h || t1 == m || t1 == s) {
    cout << "NO" << endl;
    return;
  };
  if (t2 == h || t2 == m || t2 == s) {
    cout << "NO" << endl;
    return;
  };
  long double t = t1;
  while (t != t2) {
    if (t == h || t == m || t == s) break;
    if (t - floor(t))
      t += .5, t -= t * (t == 60.0);
    else
      t += .5;
  }
  if (t == t2) {
    cout << "YES" << endl;
    return;
  };
  t = t1;
  while (t != t2) {
    if (t == h || t == m || t == s) break;
    if (t - floor(t))
      t -= .5;
    else
      t -= .5, t += 60 * (t == -.5);
  }
  if (t == t2) {
    cout << "YES" << endl;
    return;
  };
  {
    cout << "NO" << endl;
    return;
  };
}
void prep() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  prep();
  cout << fixed << setprecision(10);
  while (t--) solve();
  return 0;
}
