n = int(input())
line = input()
arr= line.split(" ")
nums = []
for c in range(n):
    nums.append(int(arr[c]))

flag = "true"
convert_n = 0
while flag == "true":
    flag = "false"
    for i in range(len(nums)-1, 0, -1):
        if nums[i] < nums[i-1]:
            tmp = nums[i]
            nums[i] = nums[i-1]
            nums[i-1] = tmp
            flag = "true"
            convert_n += 1
            
n_list_str = ""
for num in nums:
    n_list_str += str(num)
    n_list_str += " "
print(n_list_str.rstrip(" "))
print(convert_n) n = int(input()) n int(input()) int input() input line = input() line input() input arr= line.split(" ") arr line.split(" ") line.split line split " " nums = [] nums [] for c in range(n):
    nums.append(int(arr[c])) c range(n) range n nums.append(int(arr[c])) nums.append nums append int(arr[c]) int arr[c] arr c flag = "true" flag "true" convert_n = 0 convert_n 0 while flag == "true":
    flag = "false"
    for i in range(len(nums)-1, 0, -1):
        if nums[i] < nums[i-1]:
            tmp = nums[i]
            nums[i] = nums[i-1]
            nums[i-1] = tmp
            flag = "true"
            convert_n += 1
             flag == "true" flag "true" flag = "false" flag "false" for i in range(len(nums)-1, 0, -1):
        if nums[i] < nums[i-1]:
            tmp = nums[i]
            nums[i] = nums[i-1]
            nums[i-1] = tmp
            flag = "true"
            convert_n += 1
             i range(len(nums)-1, 0, -1) range len(nums)-1 len(nums) len nums 1 0 -1 if nums[i] < nums[i-1]:
            tmp = nums[i]
            nums[i] = nums[i-1]
            nums[i-1] = tmp
            flag = "true"
            convert_n += 1
             nums[i] < nums[i-1] nums[i] nums i nums[i-1] nums i-1 i 1 tmp = nums[i] tmp nums[i] nums i nums[i] = nums[i-1] nums[i] nums i nums[i-1] nums i-1 i 1 nums[i-1] = tmp nums[i-1] nums i-1 i 1 tmp flag = "true" flag "true" convert_n += 1 convert_n 1 n_list_str = "" n_list_str "" for num in nums:
    n_list_str += str(num)
    n_list_str += " " num nums n_list_str += str(num) n_list_str str(num) str num n_list_str += " " n_list_str " " print(n_list_str.rstrip(" ")) print n_list_str.rstrip(" ") n_list_str.rstrip n_list_str rstrip " " print(convert_n) print convert_n n_list_str += " " " " n_list_str flag = "true" "true" flag flag = "false" "false" flag tmp = nums[i] nums[i] tmp convert_n += 1 1 convert_n n_list_str = "" "" n_list_str line = input() input() line convert_n = 0 0 convert_n n_list_str += str(num) str(num) n_list_str n = int(input()) int(input()) n flag = "true" "true" flag arr= line.split(" ") line.split(" ") arr nums = [] [] nums
n = int(input())
line = input()
arr= line.split(" ")
nums = []
for c in range(n):
    nums.append(int(arr[c]))

flag = "true"
convert_n = 0
while flag == "true":
    flag = "false"
    for i in range(len(nums)-1, 0, -1):
        if nums[i] < nums[i-1]:
            tmp = nums[i]
            nums[i] = nums[i-1]
            nums[i-1] = tmp
            flag = "true"
            convert_n += 1
            
n_list_str = ""
for num in nums:
    n_list_str += str(num)
    n_list_str += " "
print(n_list_str.rstrip(" "))
print(convert_n)