#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
const long double EPS = 1e-9;
const int MOD = 1000000007;
const long long LLINF = 1000000000000000001;
const int maxn = 1042;
int n;
int a[maxn];
char ans[maxn][maxn];
bool good[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (int j = 1; j <= n; j++) ans[i][j] = '.';
  }
  bool none = true;
  for (int i = 1; i <= n; i++)
    if (a[i] != i) none = false;
  if (none)
    cout << n << '\n';
  else {
    cout << n - 1 << '\n';
    int mostleft = 1;
    while (a[mostleft] == mostleft) {
      good[mostleft] = true;
      mostleft++;
    }
    int row = 1;
    int z = mostleft;
    good[z] = true;
    z = a[z];
    while (!good[z]) {
      good[z] = true;
      char mirror = (z < a[z]) ? '/' : '\\';
      ans[row][z] = mirror;
      ans[row][a[z]] = mirror;
      row++;
      z = a[z];
    }
    good[z] = true;
    for (int i = mostleft + 1; i <= n; i++) {
      if (a[i] != i && !good[i]) {
        int firstrow = row;
        z = i;
        while (a[z] > z) z = a[z];
        z = a[z];
        good[z] = true;
        row++;
        z = a[z];
        while (!good[z]) {
          good[z] = true;
          char mirror = (z < a[z]) ? '/' : '\\';
          ans[row][z] = mirror;
          ans[row][a[z]] = mirror;
          row++;
          z = a[z];
        }
        ans[row - 1][mostleft] = '\\';
        ans[firstrow][mostleft] = '/';
        ans[firstrow][a[z]] = '/';
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << ans[i][j];
    cout << endl;
  }
}
