#include <bits/stdc++.h>
char a[1001][1001];
int n, i, j, s = 0;
int main() {
  scanf("%d", &n);
  if (n % 2 == 1) {
    printf("%d\n", n / 2 * n + n / 2 + 1);
    for (i = 1; i <= n; i++) {
      if (i % 2 == 1) {
        for (j = 1; j < n; j += 2) printf("C.");
        printf("C");
        printf("\n");
      } else {
        for (j = 2; j <= n; j += 2) printf(".C");
        printf(".");
        printf("\n");
      }
    }
  }
  if (n % 2 == 0) {
    printf("%d\n", n * n / 2);
    for (i = 1; i <= n; i++) {
      if (i % 2 == 1) {
        for (j = 1; j < n; j += 2) printf("C.");
        printf("\n");
      } else {
        for (j = 2; j <= n; j += 2) printf(".C");
        printf("\n");
      }
    }
  }
  return 0;
}
