#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, p[N], cnt;
char s[N][N];
bool vis[N];
int main() {
  scanf("%d", &n);
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    if (p[i] != i) flag = false;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) s[i][j] = '.';
  if (!flag) {
    int la = n;
    while (p[la] == la) la--;
    for (int i = n; i; i--)
      if (p[i] < i && !vis[i]) {
        int cnt0 = ++cnt, tmp = p[i];
        vis[i] = true;
        while (tmp != i) {
          ++cnt, vis[tmp] = true;
          if (p[tmp] > tmp)
            s[cnt][tmp] = s[cnt][p[tmp]] = '/';
          else
            s[cnt][tmp] = s[cnt][p[tmp]] = '\\';
          tmp = p[tmp];
        }
        if (i != la) s[cnt][la] = '/', s[cnt0][la] = s[cnt0][p[i]] = '\\';
      }
    printf("%d\n", n - 1);
  } else
    printf("%d\n", n);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) printf("%c", s[i][j]);
    printf("\n");
  }
  return 0;
}
