#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  bool B;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < (n + 1); ++i) {
    cin >> i;
    v.push_back(i);
  }
  if (n == 3 && ((v[0] == 1 && v[1] == 2 && v[2] == 3) ||
                 (v[0] == 1 & v[1] == 3 && v[2] == 2) ||
                 (v[0] == 2 && v[1] == 1 && v[2] == 3) ||
                 (v[0] == 2 & v[1] == 3 && v[2] == 1) ||
                 (v[0] == 3 & v[1] == 1 && v[2] == 2) ||
                 (v[0] == 3 && v[1] == 2 && v[2] == 1))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
