#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int arr[3], ban[62][62];
bool sanmy(double x) { return (x - int(x) <= (1e-9)); }
int fix(int x) {
  if (x < 0) x = 59;
  if (x > 59) x = 0;
  return x;
}
void bang(double x) {
  if (sanmy(x)) {
    arr[0] = fix(int(x) - 1);
    arr[1] = fix(int(x));
    arr[2] = fix(int(x) + 1);
    ban[arr[0]][arr[1]] = ban[arr[1]][arr[0]] = 1;
    ban[arr[1]][arr[2]] = ban[arr[2]][arr[1]] = 1;
  } else {
    arr[0] = fix(int(x));
    arr[1] = fix(int(x) + 1);
    ban[arr[0]][arr[1]] = ban[arr[1]][arr[0]] = 1;
  }
}
int main() {
  double a, b, c;
  int why;
  cin >> why;
  cin >> b >> c;
  why %= 12;
  a = double(why);
  int t1, t2;
  cin >> t1 >> t2;
  t1 %= 12;
  t2 %= 12;
  t1 *= 5;
  t2 *= 5;
  b += c / 60.0;
  a += b / 60.0;
  a *= 5;
  bang(a);
  bang(b);
  bang(c);
  int tmp = t1;
  while (1) {
    if (t1 == t2) return puts("YES") * 0;
    if (ban[fix(t1)][fix(t1 + 1)]) break;
    t1 = fix(t1 + 1);
  }
  t1 = tmp;
  while (1) {
    if (t1 == t2) return puts("YES") * 0;
    if (ban[fix(t1)][fix(t1 - 1)]) break;
    t1 = fix(t1 - 1);
  }
  puts("NO");
  return 0;
}
