#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  m = n;
  int a = 1;
  string x[n][m];
  string p = "C";
  string e = ".";
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if (a % 2 != 0) {
        x[i][j] = p;
      } else {
        x[i][j] = e;
      }
      a++;
    }
    a = 1;
    string aux = p;
    p = e;
    e = aux;
  }
  int c = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (x[i][j] == "C") {
        c++;
      }
    }
  }
  cout << c << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << x[i][j];
    }
    cout << "\n";
  }
  return 0;
}
