#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int i, j, n, a[maxn], g[maxn], t, ans;
char s[maxn][maxn];
bool bz[maxn];
int main() {
  scanf("%d", &n);
  ans = n;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    g[a[i]] = i;
    if (i != a[i]) ans = n - 1;
    for (j = 1; j <= n; j++) s[i][j] = '.';
  }
  printf("%d\n", ans);
  if (ans == n) {
    for (i = 1; i <= n; i++) printf("%s\n", s[i] + 1);
    return 0;
  }
  t = n + 1;
  if (a[n] != n) {
    for (j = n; !bz[j]; j = a[j]) bz[j] = 1;
  }
  for (i = 1; i <= n - 1; i++)
    if (!bz[i] && a[i] != i) {
      s[t - 1][n] = '/';
      for (j = i; !bz[j]; j = g[j]) {
        bz[j] = 1;
        if (j == a[i]) continue;
        t--;
        if (a[j] > j)
          s[t][j] = s[t][a[j]] = '/';
        else
          s[t][j] = s[t][a[j]] = '\\';
      }
      j = a[i], t--, s[t][n] = s[t][a[j]] = '\\';
    }
  if (a[n] != n) {
    for (j = g[n];; j = g[j]) {
      if (j == n) break;
      t--;
      if (a[j] > j)
        s[t][j] = s[t][a[j]] = '/';
      else
        s[t][j] = s[t][a[j]] = '\\';
    }
  }
  for (i = 1; i <= n; i++) printf("%s\n", s[i] + 1);
}
