#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = ((res % p) * (x % p)) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int pow1(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = x * x;
  }
  return res;
}
const long long int N = 1e5 + 1;
void solve() {
  long long int n, h, t1, t2, m, k, p = 0, q = 0, s = 0, c = 0, i, j;
  cin >> h >> m >> s >> t1 >> t2;
  h = (h * 5) % 60;
  t1 = (t1 * 5) % 60;
  t2 = (t2 * 5) % 60;
  h *= 100;
  m *= 100;
  s *= 100;
  t1 *= 100;
  t2 *= 100;
  if (s != 0) m++;
  if (m != 0) h++;
  vector<int> a;
  a.push_back(h), a.push_back(m), a.push_back(s), a.push_back(t1),
      a.push_back(t2);
  sort(a.begin(), a.end());
  bool fg = 0;
  for (long long int i = 0; i < 5; i++) {
    if (a[i] == t1 && a[(i + 1) % 5] == t2) fg = 1;
    if (a[i] == t2 && a[(i + 1) % 5] == t1) fg = 1;
  }
  if (fg)
    cout << "YES";
  else
    cout << "NO";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
