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