#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double Pi = acos(-1);
using namespace std;
int debug = 01;
int main() {
  int n;
  cin >> n;
  char g[n][n];
  cout << (n * n + 1) / 2 << "\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((i + j) & 1)
        cout << ".";
      else
        cout << "C";
    }
    cout << "\n";
  }
}
