#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, flag = 0;
  cin >> n;
  m = ceil((float)n * n / 2);
  cout << m << endl;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (flag == 0) {
        cout << "C";
        flag = 1;
      } else {
        cout << ".";
        flag = 0;
      }
    }
    cout << endl;
    if (n % 2 == 0) flag = !flag;
  }
}
