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