num = 1
top = 0
bottom = n
left = 0
right = n
if n == 1:
print(1)
else:
for i in range(n*n):
for j in range(left,right-1):
s[top][j] = num
num += 1
top += 1
for j in range(top-1,bottom-1):
s[j][right-1] = num
num += 1
right -= 1
if top < bottom:
for j in range(right,left,-1):
s[bottom-1][j] = num
num += 1
bottom -= 1
if left < right:
for j in range(bottom,top-1,-1):
s[j][left] = num
num += 1
left += 1