#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  long long cnt = 0;
  long long ans = 0;
  long long n, m = 0;
  string s[1005];
  long long posC = 0;
  cin >> n;
  if (n % 2 == 0) {
    ans = n * (n / 2);
  } else {
    ans = (n * n) / 2 + 1;
  }
  cout << ans << endl;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (i % 2 == 1 and j % 2 == 1 or i % 2 == 0 and j % 2 == 0) {
        cout << "C";
      } else {
        cout << ".";
      }
    }
    cout << endl;
  }
}
