#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char a[1001][1001]{0};
  long c = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (a[i - 1][j] != 'C' && a[i][j - 1] != 'C') {
        a[i][j] = 'C';
        ++c;
      } else
        a[i][j] = '.';
    }
  }
  cout << c << endl;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) cout << a[i][j];
    cout << endl;
  }
  return 0;
}
