#include<bits/stdc++.h>
#define int unsigned long long
#define all(x) begin(x), end(x)
#define SZ(x) ((int)(x).size())
#define EB emplace_back
#define PB push_back
#define PP pop_back
#define MP make_pair
#define F first
#define S second
#define de(x) if(x && x == MODE)
#define MODE 1

using namespace std;

typedef pair<int, int> pii;
const int INF = 1e18;
const int maxn = 1e5 + 7;

int n;

int chk(int x) {
    return x * (x + 1) <= (n+1) * 2;
}

int bs(int l, int r) {
    if (l == r)
        return l;
    int m = (l + r + 1) / 2;
    if (chk(m))
        return bs(m, r);
    else
        return bs(l, m-1);
}

int32_t main() {
    int i,j;

    cin >> n;
    int ans = (n + 1) - bs(1, 1e10);
    printf("%llu\n", ans);

    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/    \/________/\/__/   \/__/
//

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define lowbit(x) ((x)&(-(x)))
#define mid ((l+r)>>1)
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
#define fors(i, a, b) for(int i = (a); i < (b); ++i)
#define all(vec) vec.begin(),vec.end()
using namespace std;
const int maxn = 1e5 + 5;
int n;
char s[maxn];
int a[maxn];
int main()
{
    cin>>n;
    scanf("%s",s+1);
    n++; int k = 1e5;
    fors(i,1,n+1) scanf("%d", &a[i]);
    fors(i,1,n) k = min(k, abs(a[i]-a[i+1]));
    cout<<k<<endl;
    fors(i,0,k){
        fors(j,1,n+1) cout<<a[j]/k + (i < a[j]%k)<<" \n"[j==n];
    }
}
