#include <bits/stdc++.h>
int main() {
  int len;
  scanf("%d", &len);
  bool pl = true;
  int ll = 0;
  char cln[len][len];
  for (int xl = 0; xl < len; xl++) {
    for (int cl = 0; cl < len; cl++) {
      if (pl == true) {
        if (cl % 2 == 0) {
          cln[xl][cl] = 'C';
          ll++;
        } else
          cln[xl][cl] = '.';
      } else if (pl == false) {
        if (cl % 2 == 0) {
          cln[xl][cl] = '.';
        } else {
          cln[xl][cl] = 'C';
          ll++;
        }
      }
    }
    if (pl == true)
      pl = false;
    else if (pl == false)
      pl = true;
  }
  printf("%d\n", ll);
  for (int xl = 0; xl < len; xl++) {
    for (int cl = 0; cl < len; cl++) {
      printf("%c", cln[xl][cl]);
      if (cl + 1 == len) printf("\n");
    }
  }
  return 0;
}
