#include <bits/stdc++.h>
using namespace std;
char c[1015][1015];
int main() {
  memset(c, '.', sizeof(c));
  int n;
  cin >> n;
  int s = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((i + j) % 2 == 0) c[i][j] = 'C';
    }
  }
  cout << (n * n + 1) / 2 << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << c[i][j];
    }
    cout << endl;
  }
  return 0;
}
