#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool even = true;
  int even_lines = (n + 1) / 2;
  int odd_lines = n / 2;
  cout << even_lines * even_lines + odd_lines * odd_lines << endl;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (even && j % 2 == 0 || !even && j % 2) {
        cout << 'C';
      } else {
        cout << '.';
      }
    }
    cout << endl;
    even = !even;
  }
  return 0;
}
