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