#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
bool vis[maxn];
int n, m, k, p[maxn], a[maxn];
char s[maxn][maxn];
void func(int x, int y) {
  --m;
  if (x <= y) {
    s[m][x] = s[m][y] = '/';
  } else {
    s[m][x] = s[m][y] = '\\';
  }
}
int main() {
  scanf("%d", &n);
  m = n + 1, k = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    for (int j = 1; j <= n; j++) {
      s[i][j] = '.';
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      int c = 0, v = i;
      while (!vis[v]) {
        a[++c] = v;
        vis[v] = 1;
        v = p[v];
      }
      if (c <= 1) continue;
      reverse(a + 1, a + c + 1);
      if (k == 0) {
        func(a[1], a[1]);
        k = a[c];
        for (int i = 2; i <= c; i++) {
          func(a[i], a[i - 1]);
        }
        continue;
      }
      for (int i = 1; i <= c; i++) {
        if (k <= a[i] && a[i] <= a[i == c ? 1 : i + 1]) {
          func(a[i == c ? 1 : i + 1], a[i]);
          s[m][k] = '\\';
          for (int j = i + 2; j <= c; j++) {
            func(a[j], a[j - 1]);
          }
          for (int j = (i == c) + 1; j < i; j++) {
            func(a[j], a[j == 1 ? c : j - 1]);
          }
          func(k, a[i == 1 ? c : i - 1]);
          break;
        } else if (k >= a[i] && a[i] >= a[i == c ? 1 : i + 1]) {
          func(a[i == c ? 1 : i + 1], a[i]);
          s[m][k] = '/';
          for (int j = i + 2; j <= c; j++) {
            func(a[j], a[j - 1]);
          }
          for (int j = 1; j < i; j++) {
            func(a[j], a[j == 1 ? c : j - 1]);
          }
          func(k, a[i == 1 ? c : i - 1]);
          break;
        }
      }
    }
  }
  printf("%d\n", k == 0 ? n : n - 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      putchar(s[i][j]);
    }
    putchar('\n');
  }
  return 0;
}
