#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a, b, c, x, y, z;
  std::string ans = "No";
  cin >> n;
  if (n % 3 == 0) {
    cin >> a >> b >> c;
    if ((a | b) - (a & b) == c) ans = "Yes";
    if (n > 3) {
      for (int i = 1; i < n / 3; i++) {
        cin >> x >> y >> z;
        if (a != x || b != y || c != z) {
          ans = "No";
          break;
        }
      }
    }
  } else {
    ans = "Yes";
    for (int i = 0; i < n; i++) {
      cin >> a;
      if (a != 0) {
        ans = "No";
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
