#include <bits/stdc++.h>
using namespace std;
const long long BEK = 1e16;
const long long ZAT = 1e9 + 7;
const long long MAZ = 1e9 + 1;
const long long HIT = 1e6 + 1;
const long long KTL = 1e5 + 1;
long long n, ans = 0;
int main() {
  cin >> n;
  cout << (n * n + 1) / 2 << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i % 2 == 1 || i == 1) {
        if (j % 2 == 1 || j == 1) {
          cout << "C";
          ans++;
        } else
          cout << ".";
      } else {
        if (j % 2 == 0) {
          cout << "C";
          ans++;
        } else
          cout << ".";
      }
    }
    cout << endl;
  }
  return 0;
}
