#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int neginf = 0xc0c0c0c0;
int main() {
  int h, m, s, t1, t2;
  cin >> h >> m >> s >> t1 >> t2;
  double degS = 6 * s;
  double degM = 6 * m + degS / 60.0;
  double degH = 30 * h + degM / 60.0;
  double d1 = t1 * 30;
  double d2 = t2 * 30;
  int countEntre = 0;
  if (d1 > d2) {
    if (degS >= d2 && degS <= d1) countEntre++;
    if (degM >= d2 && degM <= d1) countEntre++;
    if (degH >= d2 && degH <= d1) countEntre++;
  } else {
    swap(d1, d2);
    if (degS >= d2 && degS <= d1) countEntre++;
    if (degM >= d2 && degM <= d1) countEntre++;
    if (degH >= d2 && degH <= d1) countEntre++;
  }
  if (countEntre == 0 || countEntre == 3)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
