#include <bits/stdc++.h>
using namespace std;
int p[1010];
bool vis[1010];
char s[1010][1010];
int now;
void work(int x) {
  for (int i = x; !vis[i]; i = p[i]) {
    vis[i] = true;
    if (vis[p[i]]) break;
    now++;
    if (i < p[i])
      s[now][i] = s[now][p[i]] = '/';
    else
      s[now][i] = s[now][p[i]] = '\\';
  }
}
int main() {
  int n, ans;
  memset(s, 0, sizeof(s));
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) s[i][j] = '.';
  ans = n;
  for (int i = 1; i <= n; i++)
    if (p[i] != i) ans = n - 1;
  memset(vis, 0, sizeof(vis));
  now = 0;
  work(p[n]);
  for (int i = 1; i < n; i++)
    if (!vis[i]) {
      if (i == p[i]) continue;
      now++;
      s[now][p[p[i]]] = '\\';
      s[now][n] = '\\';
      work(p[p[i]]);
      s[now][n] = '/';
    }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%s\n", s[i] + 1);
  return 0;
}
