You are given a sequence a_1, a_2, ..., a_n consisting of n non-zero integers (i.e. a_i ≠ 0). 

You have to calculate two following values:

  1. the number of pairs of indices (l, r) (l ≤ r) such that a_l ⋅ a_{l + 1} ... a_{r - 1} ⋅ a_r is negative; 
  2. the number of pairs of indices (l, r) (l ≤ r) such that a_l ⋅ a_{l + 1} ... a_{r - 1} ⋅ a_r is positive; 

Input

The first line contains one integer n (1 ≤ n ≤ 2 ⋅ 10^{5}) — the number of elements in the sequence.

The second line contains n integers a_1, a_2, ..., a_n (-10^{9} ≤ a_i ≤ 10^{9}; a_i ≠ 0) — the elements of the sequence.

Output

Print two integers — the number of subsegments with negative product and the number of subsegments with positive product, respectively.

Examples

Input


5
5 -3 3 -1 1


Output


8 7


Input


10
4 2 -4 3 1 2 -4 3 2 3


Output


28 27


Input


5
-1 -2 -3 -4 -5


Output


9 6
import sys
input = sys.stdin.readline

def One(type):
	return (type(input()))
def List(type):
	return list(map(type,input().split()))
def Str():
	return (list(input()))
def Many(type):
	return map(type,input().split())


def main():
	n = One(int)
	m = List(int)

	ansp = ansn = 0
	neg = []
	for i,nxt in enumerate(m): 
		if nxt<0: neg.append(i);

	odd = even = 0

	for i,nxt in enumerate(neg):
		if i==0:
			even+=nxt+1
			ansn+=nxt+1
			ansp+=nxt*(nxt+1)//2
			#print(ansp,ansn,even,odd)
			continue

		val = nxt-neg[i-1]

		if i%2==1:
			ansp+=val*(val-1)//2+even+odd*(val-1)
			ansn+=even*(val-1)+val+odd
			odd+=val
		else:
			ansp+=val*(val-1)//2+odd+even*(val-1)
			ansn+=odd*(val-1)+val+even
			even+=val

	if len(neg)>0:
		if neg[len(neg)-1]<n-1:
			val = n-1-neg[len(neg)-1]
			ansp+=val*(val+1)//2 + (even if len(neg)%2==0 else odd)*val
			ansn+=val*(odd if len(neg)%2==0 else even)
	else:
		ansp+=n*(n+1)//2

	print(ansn,ansp)

main()
