#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (min(a, b) > 0) {
    if (a < b) swap(a, b);
    a = a % b;
  }
  return max(a, b);
}
long long dx[] = {0, 1, 0, -1, 1, -1, -1, 1};
long long dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 10;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  ;
  for (long long i = 0; i < (n); i++) cin >> a[i];
  sort(a.begin(), a.end());
  long long type = 1;
  string ans = "No";
  ;
  for (long long i = 0; i < (n - 1); i++)
    if (a[i] < a[i + 1]) type++;
  if (type == 1) {
    if (a[0] == 0) ans = "Yes";
  } else if (type == 2) {
    if (n % 3 == 0) {
      if (a[n / 3 - 1] < a[n / 3]) ans = "Yes";
    }
  } else if (type == 3) {
    if (a[n / 3 - 1] < a[n / 3] && a[2 * n / 3 - 1] < a[2 * n / 3]) ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}
