#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  cin >> num;
  int ans = (num * num) / 2;
  if (num % 2 != 0) ans += 1;
  if (num % 2 == 0) {
    cout << ans << endl;
    for (int i = 1; i <= num; i++) {
      for (int j = 1; j <= num; j += 2) {
        if (i % 2 != 0)
          printf("C.");
        else
          printf(".C");
      }
      printf("\n");
    }
  } else if (num % 2 != 0) {
    cout << ans << endl;
    for (int i = 1; i <= num; i++) {
      for (int j = 1; j <= num / 2; j++) {
        if (i % 2 != 0)
          printf("C.");
        else
          printf(".C");
      }
      if (i % 2 != 0)
        printf("C");
      else
        printf(".");
      printf("\n");
    }
  }
  return 0;
}
