#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  bool c = true, d = false;
  cout << (n * n + 1) / 2 << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (c && !d) {
        cout << "C";
        c = false;
        d = true;
      } else if (d && !c) {
        cout << ".";
        d = false;
        c = true;
      }
    }
    cout << endl;
    if (c && n % 2 == 0) {
      c = false;
      d = true;
    } else if (d && n % 2 == 0) {
      d = false;
      c = true;
    }
  }
  return 0;
}
