#include <bits/stdc++.h>
using namespace std;
vector<int> v;
string int_to_string(int a) { return to_string(a); }
double string_to_int(string s) {
  stringstream x(s);
  double a = 0;
  x >> a;
  return a;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
int main() {
  int b, c, n, cnt = 0;
  cin >> n;
  char a[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((i % 2 == 0 && j % 2 == 0) || (i % 2 != 0 && j % 2 != 0)) {
        a[i][j] = 'C';
        cnt++;
      } else
        a[i][j] = '.';
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << a[i][j];
    }
    cout << endl;
  }
}
