#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a, b;
  a = b = "";
  int numa = 0, numb = 0;
  for (int i = 0; i < n; i++)
    if (i % 2 == 0) {
      a = a + 'C';
      numa++;
    } else
      a += '.';
  b = a.substr(1, n - 1);
  numb = numa - 1;
  if (a[n - 1] == 'C')
    b += '.';
  else {
    b += 'C';
    numb++;
  }
  cout << numa * ((n + 1) / 2) + numb * (n - (n + 1) / 2) << endl;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      cout << a << endl;
    } else
      cout << b << endl;
  }
  return 0;
}
