#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  double b = 0;
  cin >> n;
  b = n;
  b = (b * b) / 2;
  cout << ceil(b) << endl;
  char x[n][n];
  for (int i = 0; i < n; i++) {
    if (n % 2 == 0 && (i % 2 == 0 || i == 0))
      x[i][0] = '.';
    else if (n % 2 == 0 && (i % 2 > 0))
      x[i][0] = 'C';
    else if (n % 2 > 0 && (i % 2 == 0 || i == 0))
      x[i][0] = 'C';
    else
      x[i][0] = '.';
    cout << x[i][0];
    for (int j = 1; j < n; j++) {
      x[i][j - 1] == '.' ? x[i][j] = 'C' : x[i][j] = '.';
      cout << x[i][j];
    }
    cout << endl;
  }
  return 0;
}
