#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long long m = (n * n + 1) / 2;
  cout << m << "\n";
  bool b = 1;
  for (int i = 0; i != n; ++i) {
    for (int j = 0; j != n; ++j) {
      cout << (b ? 'C' : '.');
      b = !b;
    }
    if ((n & 1) == 0) b = !b;
    cout << "\n";
  }
  return 0;
}
