class Bit: def __init__(self,n): self.size=n self.tree=[0]*(n+1) def sum(self, i): s=0 while i>0: s+=self.tree[i] i-=i&-i return s def add(self,i,x): while i<=self.size: self.tree[i]+=x i+=i&-i def inversion(a,flag=True): n=len(a) if flag: b=[(a[i],i+1) for i in range(n)] b.sort(key=lambda x:x[0]) a=[i[1] for i in b] bit=Bit(n) cnt=0 for i in range(n): bit.add(a[i],1) cnt+=i+1-bit.sum(a[i]) return cnt n=int(input()) a=list(map(int,input().split())) x=n//2 if n%2==0: c1=[0]*n c2=[0]*n big1=list(range(1,n+1,2))[::-1] small1=list(range(2,n+1,2))[::-1] big2=list(range(2,n+1,2))[::-1] small2=list(range(1,n+1,2))[::-1] for i in range(n): if a[i]<=x: c1[i]=small1.pop() c2[i]=small2.pop() else: c1[i]=big1.pop() c2[i]=big2.pop() print(x,min(inversion(c1,flag=False),inversion(c2,flag=False))) else: c=[0]*n small=list(range(2,n+1,2))[::-1] big=list(range(1,n+1,2))[::-1] for i in range(n): if a[i]<=x: c[i]=small.pop() else: c[i]=big.pop() print(x,inversion(c,flag=False))