#include <bits/stdc++.h>
const int N = 100005;
std::vector<std::pair<int, int> > ans;
int a[N], n, nosolution;
void reverse(int L, int R) {
  a[L] ^= 1, a[R] ^= 1, a[L + R >> 1] ^= 1, ans.push_back(std::make_pair(L, R));
}
void solve1(int l, int r) {
  std::vector<std::pair<int, int> > p;
  for (int i = l; i <= r; i++)
    for (int j = i + 2; j <= r; j += 2) p.push_back(std::make_pair(i, j));
  int len = p.size();
  static int tmp[N];
  for (int i = 0; i < 1 << len; i++) {
    for (int k = l; k <= r; k++) tmp[k] = a[k];
    for (int k = 0; k < len; k++)
      if (i >> k & 1)
        tmp[p[k].first] ^= 1, tmp[p[k].second] ^= 1,
            tmp[p[k].first + p[k].second >> 1] ^= 1;
    ;
    int flag = 0;
    for (int k = l; k <= r; k++)
      if (tmp[k]) flag = 1;
    if (!flag) {
      for (int k = 0; k < len; k++)
        if (i >> k & 1) ans.push_back(p[k]);
      return;
    }
  }
  nosolution = 1;
}
void solve(int l, int r) {
  if (r - l + 1 <= 8) {
    while (l > 1 && r - l + 1 < 8) l--;
    while (r < n && r - l + 1 < 8) r++;
    return solve1(l, r);
  }
  if (!a[l]) return solve(l + 1, r);
  if (!a[r]) return solve(l, r - 1);
  if (a[l] && a[l + 1] && a[l + 2]) {
    reverse(l, l + 2);
    return solve(l + 3, r);
  }
  if (a[r] && a[r - 1] && a[r - 2]) {
    reverse(r - 2, r);
    return solve(l, r - 3);
  }
  if (a[l] && a[l + 2]) {
    reverse(l, l + 4);
    return solve(l + 3, r);
  }
  if (a[r] && a[r - 2]) {
    reverse(r - 4, r);
    return solve(l, r - 3);
  }
  if (a[l] && !a[l + 1] && !a[l + 2]) {
    reverse(l, l + 6);
    return solve(l + 3, r);
  }
  if (a[r] && !a[r - 1] && !a[r - 2]) {
    reverse(r - 6, r);
    return solve(l, r - 3);
  }
  if (r - l & 1) {
    reverse(l, r - 1);
    reverse(l + 1, r);
    return solve(l + 3, r - 3);
  } else {
    reverse(l, r);
    reverse(l + 1, r - 1);
    return solve(l + 3, r - 3);
  }
}
int main() {
  std::cin >> n;
  for (int i = 1; i <= n; i++) std::cin >> a[i];
  solve(1, n);
  if (nosolution)
    std::cout << "NO\n";
  else {
    std::cout << "YES\n" << ans.size() << "\n";
    for (std::pair<int, int> i : ans)
      std::cout << i.first << " " << (i.first + i.second >> 1) << " "
                << i.second << "\n";
  }
  return 0;
}
