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 java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;

public class Div_2_585 {

	static Reader r = new Reader();
	static PrintWriter out = new PrintWriter(System.out);

	private static void solve1() throws IOException {

		StringBuilder res = new StringBuilder();

		int a1 = r.nextInt();
		int a2 = r.nextInt();
		int k1 = r.nextInt();
		int k2 = r.nextInt();
		int n = r.nextInt();

		int max = Math.max(Math.min(n / k1, a1) + Math.min((n - k1 * (Math.min(n / k1, a1))) / k2, a2),
				Math.min(n / k2, a2) + Math.min((n - k2 * (Math.min(n / k2, a2))) / k1, a1));
		int min = 0;
		if ((k1 - 1) * a1 + (k2 - 1) * a2 < n) {
			int rem = n - (((k1 - 1) * a1) + ((k2 - 1) * a2));
			min = Math.min(rem, a1 + a2);
		}

		res.append(min + " " + max).append("\n");
		out.print(res);
		out.close();

	}

	private static void solve2() throws IOException {

		StringBuilder res = new StringBuilder();

		int n = r.nextInt();
		long arr[] = r.nextLongArray(n);

		int ev = 0, od = 0, bal = 0;

		long pos = 0;

		for (int i = 0; i < n; i++) {
			if ((bal & 1) == 0) {
				ev++;
			} else {
				od++;
			}
			if (arr[i] < 0) {
				bal++;
			}
			if ((bal & 1) == 0) {
				pos += ev;
			} else {
				pos += od;
			}
		}

		res.append(((long) ((long) n * (n + 1) / 2) - pos) + " " + pos).append("\n");
		out.print(res);
		out.close();

	}

	private static void solve3() throws IOException {

		StringBuilder res = new StringBuilder();

		int n = r.nextInt();

		char s[] = r.next().toCharArray();
		char t[] = r.next().toCharArray();

		ArrayList<Integer> ab = new ArrayList<Integer>();
		ArrayList<Integer> ba = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			if (s[i] != t[i]) {
				if (s[i] == 'a' && t[i] == 'b') {
					ab.add(i + 1);
				} else {
					ba.add(i + 1);
				}
			}
		}

		if ((ab.size() & 1) != (ba.size() & 1)) {
			res.append(-1);
		} else {
			if ((ab.size() & 1) != 0 && (ba.size() & 1) != 0) {
				res.append(((ab.size() / 2) + (ba.size() / 2) + 2)).append("\n");
				res.append(ba.get(ba.size() - 1) + " " + ba.get(ba.size() - 1)).append("\n");
				res.append(ba.get(ba.size() - 1) + " " + ab.get(ab.size() - 1)).append("\n");
			} else {
				res.append((ab.size() / 2) + (ba.size() / 2)).append("\n");
			}
			for (int i = 0; i < ba.size(); i += 2) {
				if (i + 1 < ba.size())
					res.append(ba.get(i) + " " + ba.get(i + 1)).append("\n");
			}
			for (int i = 0; i < ab.size(); i += 2) {
				if (i + 1 < ab.size())
					res.append(ab.get(i) + " " + ab.get(i + 1)).append("\n");
			}
		}

		out.print(res);
		out.close();

	}

	private static void solve4() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			r.nextInt();

			res.append(false).append("\n");
		}

		out.print(res);
		out.close();

	}

	public static void main(String[] args) throws IOException {

//		solve1();

		solve2();

//		solve3();

//		solve4();

	}

	static class Reader {

		final private int BUFFER_SIZE = 1 << 12;
		boolean consume = false;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		private boolean reachedEnd = false;

		public Reader() {
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = 0;
			bytesRead = 0;
		}

		public boolean hasNext() {
			return !reachedEnd;
		}

		private void fillBuffer() throws IOException {
			bytesRead = System.in.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1) {
				buffer[0] = -1;
				reachedEnd = true;
			}
		}

		private void consumeSpaces() throws IOException {
			while (read() <= ' ' && reachedEnd == false)
				;
			bufferPointer--;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead) {
				fillBuffer();
			}
			return buffer[bufferPointer++];
		}

		public String next() throws IOException {
			StringBuilder sb = new StringBuilder();
			consumeSpaces();
			byte c = read();
			do {
				sb.append((char) c);
			} while ((c = read()) > ' ');
			if (consume) {
				consumeSpaces();
			}
			;
			if (sb.length() == 0) {
				return null;
			}
			return sb.toString();
		}

		public String nextLine() throws IOException {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			return str;
		}

		public int nextInt() throws IOException {
			consumeSpaces();
			int ret = 0;
			byte c = read();
			boolean neg = (c == '-');
			if (neg) {
				c = read();
			}
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (consume) {
				consumeSpaces();
			}
			if (neg) {
				return -ret;
			}
			return ret;
		}

		public long nextLong() throws IOException {
			consumeSpaces();
			long ret = 0;
			byte c = read();
			boolean neg = (c == '-');
			if (neg) {
				c = read();
			}
			do {
				ret = ret * 10L + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (consume) {
				consumeSpaces();
			}
			if (neg) {
				return -ret;
			}
			return ret;
		}

		public double nextDouble() throws IOException {
			consumeSpaces();
			double ret = 0;
			double div = 1;
			byte c = read();
			boolean neg = (c == '-');
			if (neg) {
				c = read();
			}
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}
			if (consume) {
				consumeSpaces();
			}
			if (neg) {
				return -ret;
			}
			return ret;
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextLong();
			}
			return a;
		}

		public int[][] nextIntMatrix(int n, int m) throws IOException {
			int[][] grid = new int[n][m];
			for (int i = 0; i < n; i++) {
				grid[i] = nextIntArray(m);
			}
			return grid;
		}

		public char[][] nextCharacterMatrix(int n) throws IOException {
			char[][] a = new char[n][];
			for (int i = 0; i < n; i++) {
				a[i] = next().toCharArray();
			}
			return a;
		}

		public void close() throws IOException {
			if (System.in == null) {
				return;
			} else {
				System.in.close();
			}
		}
	}

}