N = int(input()) A = list(map(int,input().split())) X = N // 2 if N & 1: st = 1 Y = 0 for i,a in enumerate(A): if a <= X: Y += abs(st-i) st += 2 else: dp = [[0]*2 for _ in range(N//2)] j = 0 for i,a in enumerate(A): if a <= X: dp[j][0] = dp[j-1][0] + abs(j*2-i) dp[j][1] = min(dp[j-1][0],dp[j-1][1]) + abs(j*2+1-i) j += 1 Y = min(dp[-1][0],dp[-2][1]) print(X,Y)