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