#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str[n];
  int count = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; ++j) {
      if (i % 2 == 0 && j % 2 == 0) {
        str[i].push_back('C');
        count++;
      } else if (i % 2 == 0 && j % 2 == 1) {
        str[i].push_back('.');
      } else if (i % 2 == 1 && j % 2 == 0) {
        str[i].push_back('.');
      } else {
        str[i].push_back('C');
        count++;
      }
    }
  }
  cout << count << endl;
  for (int i = 0; i < n; i++) {
    cout << str[i] << endl;
  }
  return 0;
}
