#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int h, m, s, t1, t2;
  cin >> h >> m >> s >> t1 >> t2;
  h %= 12;
  t1 %= 12;
  t2 %= 12;
  m /= 5;
  s /= 5;
  if (t1 > t2) swap(t1, t2);
  if (((h >= t1 && h < t2) + (m >= t1 && m < t2) + (s >= t1 && s < t2)) % 3 ==
      0) {
    cout << "YES";
  } else
    cout << "NO";
  cout << endl;
  return 0;
}
