#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 14;
int h, m, s, t1, t2;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> h >> m >> s >> t1 >> t2;
  h %= 12;
  h *= 5;
  t1 %= 12;
  t1 *= 5;
  t2 %= 12;
  t2 *= 5;
  auto check = [](int x, int y) {
    while (x != y) {
      if (x == h || x == m || x == s) return 0;
      x = (x + 1) % 60;
    }
    return 1;
  };
  cout << (check(t1, t2) || check(t2, t1) ? "YES" : "NO") << '\n';
}
