#include <bits/stdc++.h>
bool iscan[1001][1001];
int main() {
  memset(iscan, true, sizeof(bool) * 1001 * 1001);
  int n;
  scanf("%d", &n);
  printf("%d\n", (n % 2 == 0 ? n * (n - 2) / 2 : (n - 1) * (n - 1) / 2) + n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (iscan[i][j]) {
        printf("C");
        iscan[i][j + 1] = false;
        iscan[i + 1][j] = false;
      } else {
        printf(".");
      }
    }
    printf("\n");
  }
  return 0;
}
