a = [8,1,7,4,3,9,2,5,6,10]
def bubble_sort(a):
n = len(a)
unordered = True
while unordered:
unordered = False
for j in range(n - 1):
if a[j] > a[j + 1]:
a[j], a[j + 1] = a[j + 1], a[j]
unordered = True
n -= 1
a = [8,1,7,4,3,9,2,5,6,10]
def bubble_sort(a):
n = len(a)
unordered = True
operations_count = 0
while unordered:
unordered = False
operations_count += 1
for j in range(n - 1):
operations_count += 1
if a[j] > a[j + 1]:
a[j], a[j + 1] = a[j + 1], a[j]
unordered = True
n -= 1
print(str(operations_count))