#include <bits/stdc++.h>
const int inf = (1ll << 31) - 1;
using namespace std;
int main() {
  int n, c = 0;
  cin >> n;
  string S;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((i + j) % 2 == 0) {
        S += 'C';
        c++;
      } else
        S += '.';
    }
    S += '\n';
  }
  cout << c << "\n" << S;
  return 0;
}
