#include <bits/stdc++.h>
using namespace std;
int a[1000001], b[1000001], c, d, e, n, m;
long long sum, ans, k;
string second, t, st;
char ch2[1001][1001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) ch2[i][j] = '.';
  for (int i = 1; i <= n; i++) {
    if (i % 2) {
      for (int j = 1; j <= n; j += 2) ch2[i][j] = 'C', ans++;
    } else {
      for (int j = 2; j <= n; j += 2) ch2[i][j] = 'C', ans++;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << ch2[i][j];
    cout << endl;
  }
  return 0;
}
