#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int coders = 0;
  string s = "";
  for (int i = 0; i < n; i++) s += ".";
  vector<string> board(n);
  for (int i = 0; i < n; i++) board[i] = s;
  for (int i = 0; i < n; i++) {
    for (int j = i % 2; j < n; j += 2) {
      board[i][j] = 'C';
      coders++;
    }
  }
  cout << coders << endl;
  for (int i = 0; i < n; i++) cout << board[i] << endl;
  return 0;
}
