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