#include <bits/stdc++.h>
using namespace std;
int main() {
  int ROW, COL, SIZE, TOTAL;
  cin >> SIZE;
  TOTAL = ceil(SIZE / 2.0) * ceil(SIZE / 2.0);
  TOTAL = TOTAL + floor(SIZE / 2.0) * floor(SIZE / 2.0);
  printf("%d\n", TOTAL);
  for (ROW = 0; ROW < SIZE; ROW++) {
    for (COL = 0; COL < SIZE; COL++) {
      if (ROW % 2 == 0) {
        if (COL % 2 == 0)
          printf("C");
        else
          printf(".");
      } else if (COL % 2 == 0)
        printf(".");
      else
        printf("C");
    }
    printf("\n");
  }
  return 0;
}
