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