#include <bits/stdc++.h>
using namespace std;
const long long int INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
int h, m, s, t1, t2;
bool present[30] = {false};
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  scanf("%d %d %d %d %d", &h, &m, &s, &t1, &t2);
  if (h == 12) h = 0;
  int a = h * 3600 + m * 60 + s;
  int b = m * 720 + s * 12;
  int c = s * 720;
  if (t1 == 12) t1 = 0;
  if (t2 == 12) t2 = 0;
  if (t1 > t2) swap(t1, t2);
  t1 *= 3600;
  t2 *= 3600;
  if (a > t1 && a < t2 && b > t1 && b < t2 && c > t1 && c < t2) {
    cout << "YES";
    return 0;
  }
  if ((a < t1 || a > t2) && (b < t1 || b > t2) && (c < t1 || c > t2))
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
