n,*d=$<.map &:to_i i=n-1 c=s=0 d.map{i.times{|i|puts'compare =%3d swap =%3d data:'%[c+=1,s+=(p=d[i,2])<=>d[i,2]=p.sort]+'%3s'*n%d}}