#include <bits/stdc++.h>
using namespace std;
void printeven(int n) {
  cout << (n * n) / 2 << endl;
  char prev = 'C';
  cout << "C";
  for (int i = 2; i <= (n * n); i++) {
    if (prev == 'C') {
      cout << ".";
      prev = '.';
    } else {
      cout << "C";
      prev = 'C';
    }
    if (i % (n) == 0) {
      cout << endl;
      if (prev == '.')
        prev = 'C';
      else {
        prev = '.';
      }
    }
  }
}
void printodd(int n) {
  char prev = 'C';
  cout << ((n * n) / 2) + 1 << endl;
  cout << "C";
  for (int i = 2; i <= (n * n); i++) {
    if (prev == 'C') {
      cout << ".";
      prev = '.';
    } else {
      cout << "C";
      prev = 'C';
    }
    if (i % (n) == 0) cout << endl;
  }
}
int main() {
  int n;
  cin >> n;
  if (n % 2 != 0)
    printodd(n);
  else {
    printeven(n);
  }
}
