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