n = gets.to_i
ans = []
for i in 0..n
  ans[i] = []
end
t = 1
sum = 1
for i in 0..n
  for j in 0..n
    if i == j then
      ans[i][j] = 0
    elsif i < j then
      ans[i][j] = sum
      sum += t
      t += 1
    else
      ans[i][j] = ans[j][i]
    end
  end
end
for i in 0..n
  puts ans[i].join(" ")
end