N   = int(input())
A   = [int(temp) for temp in input().split()]
cou = 0

for mak in range(1,N) :
    for j in range(mak,N)[ : : -1] :
        if A[j] < A[j - 1] :
            tem      = int(A[j])
            A[j]     = int(A[j - 1])
            A[j - 1] = int(tem)
            cou = cou + 1
A   = [str(temp) for temp in A]
print(' '.join(A))
print(cou) N   = int(input()) N int(input()) int input() input int(temp) for temp in input().split() for temp in input().split() temp input().split() ().split () input split for temp in input().split() int(temp) int temp A   = [int(temp) for temp in input().split()] A [int(temp) for temp in input().split()] cou = 0 cou 0 for mak in range(1,N) :
    for j in range(mak,N)[ : : -1] :
        if A[j] < A[j - 1] :
            tem      = int(A[j])
            A[j]     = int(A[j - 1])
            A[j - 1] = int(tem)
            cou = cou + 1 mak range(1,N) range 1 N for j in range(mak,N)[ : : -1] :
        if A[j] < A[j - 1] :
            tem      = int(A[j])
            A[j]     = int(A[j - 1])
            A[j - 1] = int(tem)
            cou = cou + 1 j range(mak,N)[ : : -1] (mak,N) range mak N : : -1 -1 if A[j] < A[j - 1] :
            tem      = int(A[j])
            A[j]     = int(A[j - 1])
            A[j - 1] = int(tem)
            cou = cou + 1 A[j] < A[j - 1] A[j] A j A[j - 1] A j - 1 j 1 tem      = int(A[j]) tem int(A[j]) int A[j] A j A[j]     = int(A[j - 1]) A[j] A j int(A[j - 1]) int A[j - 1] A j - 1 j 1 A[j - 1] = int(tem) A[j - 1] A j - 1 j 1 int(tem) int tem cou = cou + 1 cou cou + 1 cou 1 str(temp) for temp in A for temp in A temp A for temp in A str(temp) str temp A   = [str(temp) for temp in A] A [str(temp) for temp in A] print(' '.join(A)) print ' '.join(A) ' '.join ' ' join A print(cou) print cou A   = [str(temp) for temp in A] [str(temp) for temp in A] A N   = int(input()) int(input()) N A   = [int(temp) for temp in input().split()] [int(temp) for temp in input().split()] A cou = 0 0 cou tem      = int(A[j]) int(A[j]) tem cou = cou + 1 cou + 1 cou
N   = int(input())
A   = [int(temp) for temp in input().split()]
cou = 0

for mak in range(1,N) :
    for j in range(mak,N)[ : : -1] :
        if A[j] < A[j - 1] :
            tem      = int(A[j])
            A[j]     = int(A[j - 1])
            A[j - 1] = int(tem)
            cou = cou + 1
A   = [str(temp) for temp in A]
print(' '.join(A))
print(cou)