#include <bits/stdc++.h>
using namespace std;
char maze[1000005];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    if (n % 2 == 0)
      cout << (n / 2) * n << endl;
    else {
      cout << (n / 2) * n + (n - n / 2) << 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';
          else
            cout << '.';
        } else {
          if (j % 2 == 0)
            cout << 'C';
          else
            cout << '.';
        }
      }
      cout << endl;
    }
  }
}
