#include <bits/stdc++.h>
using namespace std;
const int mm = 2e5 + 10;
long long T, a1, a2, a3, a4, a5, a6, a7, a8, a9, ans, ez1, n, m, k;
string s, s1, s2;
vector<int> loc1;
vector<int> loc2;
void input() {
  cin >> n >> a1 >> a2 >> a3 >> a4;
  while (a3 != a4) {
    loc2.push_back(a3);
    a3--;
    if (a3 == 0) a3 = n;
  }
  loc2.push_back(a4);
  while (a1 != a2) {
    loc1.push_back(a1);
    a1++;
    if (a1 == n + 1) a1 = 1;
  }
  loc1.push_back(a2);
}
void solve() {
  for (int i = 0; i < min(loc1.size(), loc2.size()); i++) {
    if (loc1[i] == loc2[i]) {
      cout << "YES" << endl;
      return;
    }
  }
  cout << "NO" << endl;
}
int main() {
  cin.tie(0);
  input();
  solve();
  return 0;
}
