#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - 48, ch = getchar();
  return x * f;
}
int n;
int a[N];
int m = 0;
struct Perf {
  int x, y, z;
  Perf() {}
  Perf(int _x, int _y, int _z) { x = _x, y = _y, z = _z; }
} p[N];
int find(int x, int dx) {
  while (!a[x] && 1 <= x && x <= n) x += dx;
  return x;
}
void pef(int x, int y, int z) {
  a[x] ^= 1, a[y] ^= 1, a[z] ^= 1;
  p[++m] = Perf(x, y, z);
}
int gettot() {
  int tot = 0;
  for (int i = 1; i <= n; i++) tot += a[i];
  return tot;
}
void del(int x) {
  pef(x - 6, x - 3, x);
  pef(x - 5, x - 4, x - 3);
  pef(x - 6, x - 5, x - 4);
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  int L = 1, R = n;
  while (L + 2 <= R) {
    if (a[L] && a[L + 1] && a[L + 2]) {
      pef(L, L + 1, L + 2);
      L += 3;
      continue;
    }
    if (a[R] && a[R - 1] && a[R - 2]) {
      pef(R - 2, R - 1, R);
      a[R - 2] = a[R - 1] = a[R] = 0;
      R -= 3;
    }
    if (!a[L]) {
      L++;
      continue;
    }
    if (!a[R]) {
      R--;
      continue;
    }
    int l = find(L + 1, 1);
    int r = find(R - 1, -1);
    if (l == R) break;
    if (l != L + 1 && 2 * l - L <= R) {
      pef(L, l, l * 2 - L);
      continue;
    } else if (r != R - 1 && 2 * r - R >= L) {
      pef(2 * r - R, r, R);
      continue;
    } else if (l == L + 1 && r == R - 1) {
      if ((R - L) % 2 == 0) {
        int m = (L + R) / 2;
        pef(L, m, R);
        pef(L + 1, m, R - 1);
        continue;
      } else {
        int m1 = (L + R) / 2, m2 = m1 + 1;
        pef(L, m1, R - 1);
        pef(L + 1, m2, R);
        continue;
      }
    } else if (l == L + 1 && 2 * r - R >= L) {
      pef(2 * r - R, r, R);
      continue;
    } else if (r == R - 1 && 2 * l - L <= R) {
      pef(L, l, l * 2 - L);
      continue;
    } else if (l == L + 1)
      pef(L, l, l + 1);
    else if (r == R - 1)
      pef(r - 1, r, R);
    else
      break;
  }
  if (gettot() > 0) {
    int l = find(1, 1);
    int r = find(n, -1);
    if (l != r) {
      while (r + 3 <= min(9, n)) {
        pef(r, r + 1, r + 2);
        pef(r + 1, r + 2, r + 3);
        r += 3;
      }
      while (l + 3 <= min(9, n)) {
        pef(l, l + 1, l + 2);
        pef(l + 1, l + 2, l + 3);
        l += 3;
      }
      if (gettot()) {
        if (l >= 7 && r >= 7) {
          del(l);
          del(r);
        } else {
          if ((l + r) % 2 == 0) return puts("NO"), 0;
          if (l + 1 != r) pef(l + 1, (l + r + 1) / 2, r);
          if (l + 2 <= n)
            pef(l, l + 1, l + 2), l = r = l + 2;
          else
            pef(l - 1, l, l + 1), l = r = l - 1;
        }
      }
    }
    if (gettot()) {
      while (l + 3 <= min(9, n)) {
        pef(l, l + 1, l + 2);
        pef(l + 1, l + 2, l + 3);
        l += 3;
      }
      if (l < 7) return puts("NO"), 0;
      del(l);
    }
  }
  puts("YES");
  printf("%d\n", m);
  for (int i = 1; i <= m; i++) printf("%d %d %d\n", p[i].x, p[i].y, p[i].z);
  return 0;
}
