#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char a = '.', b = 'C', temp;
  cin >> n;
  if (n % 2 == 0) {
    cout << (n / 2) * n << endl;
  } else
    cout << (n / 2) * n + n / 2 + 1 << endl;
  for (int i = 0; i < n; i++) {
    temp = a;
    a = b;
    b = temp;
    for (int j = 0; j < n; j++) {
      if (j % 2 == 0)
        cout << a;
      else
        cout << b;
    }
    cout << endl;
  }
}
