#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int l = 1;
  int arr[n];
  if (n % 2 == 0)
    cout << (n * n) / 2 << endl;
  else {
    cout << (n * n) / 2 + 1 << endl;
  }
  for (int i = 0; i < n; i++) {
    arr[i] = 1;
    for (int u = 0; u < n; u++) {
      if (i % 2 != 0) {
        if (arr[i] % 2 != 0)
          cout << ".";
        else
          cout << "C";
      } else {
        if (arr[i] % 2 != 0)
          cout << "C";
        else
          cout << ".";
      }
      arr[i]++;
    }
    cout << endl;
  }
  return 0;
}
