#include <bits/stdc++.h>
using namespace std;
const int limit = 1005;
int n;
int p[limit];
int seen[limit];
int nsol;
string sol[limit];
void generate(int u, vector<int> &lista) {
  if (seen[u]) return;
  seen[u] = 1;
  lista.push_back(u);
  generate(p[u], lista);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
    sol[i] = string(n, '.');
  }
  int counted0 = 0;
  int complex = 0;
  for (int u = 0; u < n; u++) {
    if (not seen[u]) {
      vector<int> lista;
      generate(u, lista);
      int nlista = int(lista.size());
      if (nlista == 1) {
        nsol++;
        counted0 += u == 0;
        continue;
      }
      if (u == 0)
        for (int i = 0; i < nlista - 1; i++) swap(lista[i], lista[i + 1]);
      for (int i = 0; i < nlista - 1; i++) {
        int u = lista[i];
        int v = lista[i + 1];
        if (u < v)
          sol[nsol][u] = sol[nsol][v] = '/';
        else
          sol[nsol][u] = sol[nsol][v] = '\\';
        nsol++;
      }
      if (0 < u) {
        int v = lista[nlista - 1];
        int ru = nsol - (nlista - 1);
        int rv = nsol;
        sol[rv][v] = '\\';
        sol[rv][0] = '\\';
        sol[ru][0] = '/';
        nsol++;
        complex = 1;
      }
    }
  }
  if (counted0 and complex) nsol--;
  cout << nsol << endl;
  for (int i = 0; i < n; i++) cout << sol[i] << endl;
}
