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