#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int p[maxn];
char mp[maxn][maxn];
int vis[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int flag = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
    flag &= (p[i] == i);
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) mp[i][j] = '.';
  if (flag) {
    cout << n << '\n';
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) cout << mp[i][j];
      cout << '\n';
    }
    return 0;
  } else {
    cout << n - 1 << '\n';
    int pre = 0;
    for (int i = n; i >= 1; --i) {
      if (vis[i] || p[i] == i) continue;
      int mx = 0, siz = 0;
      for (int tmp = i; !vis[tmp]; tmp = p[tmp])
        vis[tmp] = 1, mx = max(mx, tmp), ++siz;
      if (mx != n) {
        mp[pre + siz][mx] = mp[pre + siz][n] = '/';
        mp[pre + 1][p[mx]] = mp[pre + 1][n] = '\\';
      }
      mx = p[mx];
      for (int j = 2; j <= siz; ++j, mx = p[mx]) {
        char ch = mx > p[mx] ? '\\' : '/';
        mp[pre + j][mx] = mp[pre + j][p[mx]] = ch;
      }
      pre += siz;
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) cout << mp[i][j];
      cout << '\n';
    }
  }
  return 0;
}
