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