N = int(input())

a = 1
b = 2

l = []
l.append(a)
l.append(b)
if N == 2:
    print("0 1")
    print("1 0")
    exit()

for _ in range(N * (N-1) // 2 - 2):
    tmp = b
    b = b + a + 1
    a = tmp
    l.append(b)

for i in range(N):
    line = []
    for j in range(N):
        if i < j:
            num = 0
            for w in range(i):
                num += N-w-1
            num += (j-i)
            line.append(str(l[num-1]))
        elif i == j:
            line.append("0")
        else:
            num = 0
            for w in range(j):
                num += N-w-1
            num += i-j
            line.append(str(l[num-1]))
    print(" ".join(line))
