#include <bits/stdc++.h>
using namespace std;
int a[4];
int main() {
  int n, i, num, cnt = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> num;
    if (num != a[1] && num != a[2] && num != a[3]) a[++cnt] = num;
    if (cnt > 3) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
