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