#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int count = 0;
    n % 2 == 0 ? count = n* n / 2
               : count = (n + 1) / 2 * (n + 1) / 2 + (n / 2) * (n / 2);
    cout << count << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i % 2 == 0) {
          if (j % 2 == 0)
            cout << "C";
          else
            cout << ".";
        } else {
          if (j % 2 == 0)
            cout << ".";
          else
            cout << "C";
        }
      }
      cout << endl;
    }
  }
  return 0;
}
