#include <bits/stdc++.h>
char con[1000][1000];
int main() {
  int n;
  scanf("%d", &n);
  int h = -1;
  for (int i = 30; i >= 0; i--) {
    if ((1 << i) & n) {
      if (h == -1) h = i;
    }
  }
  if (n == 1) {
    printf("2\nNY\nYN\n");
    return 0;
  }
  int t = 2;
  int x = 0;
  for (int j = 0; j < h - 1; j++) {
    con[x][t] = con[t][x] = 'Y';
    con[x][t + 1] = con[t + 1][x] = 'Y';
    con[t][t + 2] = con[t + 2][t] = 'Y';
    con[t + 1][t + 2] = con[t + 2][t + 1] = 'Y';
    x = t + 2;
    t += 3;
  }
  con[x][t] = con[t][x] = 'Y';
  con[x][t + 1] = con[t + 1][x] = 'Y';
  con[t][1] = con[1][t] = 'Y';
  con[t + 1][1] = con[1][t + 1] = 'Y';
  t += 2;
  for (int i = h - 1; i >= 0; i--) {
    if ((1 << i) & n) {
      int x = i == 0 ? 0 : (3 * i + 1);
      for (int j = i; j < h - 1; j++) {
        con[x][t] = con[t][x] = 'Y';
        con[t][t + 1] = con[t + 1][t] = 'Y';
        x = t + 1;
        t += 2;
      }
      con[x][t] = con[t][x] = 'Y';
      con[t][1] = con[1][t] = 'Y';
      t += 1;
    }
  }
  printf("%d\n", t);
  for (int i = 0; i < t; i++) {
    for (int j = 0; j < t; j++) {
      if (con[i][j] == 'Y')
        printf("Y");
      else
        printf("N");
    }
    puts("");
  }
}
