Polycarpus has been working in the analytic department of the "F.R.A.U.D." company for as much as n days. Right now his task is to make a series of reports about the company's performance for the last n days. We know that the main information in a day report is value a_{i}, the company's profit on the i-th day. If a_{i} is negative, then the company suffered losses on the i-th day.

Polycarpus should sort the daily reports into folders. Each folder should include data on the company's performance for several consecutive days. Of course, the information on each of the n days should be exactly in one folder. Thus, Polycarpus puts information on the first few days in the first folder. The information on the several following days goes to the second folder, and so on.

It is known that the boss reads one daily report folder per day. If one folder has three or more reports for the days in which the company suffered losses (a_{i} < 0), he loses his temper and his wrath is terrible.

Therefore, Polycarpus wants to prepare the folders so that none of them contains information on three or more days with the loss, and the number of folders is minimal.

Write a program that, given sequence a_{i}, will print the minimum number of folders.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 100), n is the number of days. The second line contains a sequence of integers a_1, a_2, ..., a_{n} (|a_{i}| ≤ 100), where a_{i} means the company profit on the i-th day. It is possible that the company has no days with the negative a_{i}.


-----Output-----

Print an integer k — the required minimum number of folders. In the second line print a sequence of integers b_1, b_2, ..., b_{k}, where b_{j} is the number of day reports in the j-th folder.

If there are multiple ways to sort the reports into k days, print any of them.


-----Examples-----
Input
11
1 2 3 -4 -5 -6 5 -5 -6 -7 6

Output
3
5 3 3 
Input
5
0 -1 100 -1 0

Output
1
5 


-----Note-----

Here goes a way to sort the reports from the first sample into three folders:  1 2 3 -4 -5 | -6 5 -5 | -6 -7 6 

In the second sample you can put all five reports in one folder.

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
n = int(input())
s = [int(i) for i in input().split()]
d = []
(l, r) = (0, 0)
cnt = 0
while r < n:
	if cnt == 2 and s[r] < 0:
		d.append(s[l:r])
		cnt = 1
		l = r
		r += 1
	else:
		if s[r] < 0:
			cnt += 1
		r += 1
if cnt < 3:
	d.append(s[l:r])
print(len(d))
s = [len(i) for i in d]
print(*s)


n = int(input())
arr = list(map(int, input().split()))
s = 0
i = 0
l = []
while i <= n:
	while list(map(lambda a: a >= 0, arr[s:i + 1])).count(False) <= 2:
		i += 1
		if i == n:
			break
	l.append(len(arr[s:i]))
	s = i
	if i == n:
		break
print(len(l))
print(*l)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res) % MOD

def comb(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a *= n + 1 - i
		b *= i
	return a // b % MOD

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	if y == 0:
		return 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
small = 'abcdefghijklmnopqrstuvwxyz'
large = small.upper()
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve():
	n = scanner()
	a = get_list()
	c = 0
	ans = []
	v = []
	for x in a:
		if x < 0:
			c += 1
		if c == 3:
			ans.append(len(v))
			v = []
			if x < 0:
				c = 1
			else:
				c = 0
		v.append(x)
	ans.append(len(v))
	print(len(ans))
	print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = 1
for i in range(t):
	solve()


def readln():
	return tuple(map(int, input().split()))
(n,) = readln()
cnt = al = 0
ans = []
for a in readln():
	if cnt == 2 and a < 0:
		ans.append(al)
		cnt = al = 0
	al += 1
	cnt += a < 0
ans.append(al)
print(len(ans))
print(*ans)


_ = int(input())
reports_in_folder = [0]
ai = list(map(int, input().split()))
neg = 0
folder = 0
for a in ai:
	if a < 0:
		neg += 1
	if neg > 2:
		neg = 1
		folder += 1
		reports_in_folder.append(0)
	reports_in_folder[folder] += 1
print(folder + 1)
print(*reports_in_folder)


Answer = []
N = int(input())
(Negative, Count) = (0, 0)
X = list(map(int, input().split()))
for i in range(N):
	if X[i] < 0:
		if Negative == 2:
			Answer.append(Count)
			Negative = 1
			Count = 0
		else:
			Negative += 1
	Count += 1
Answer.append(Count)
print(len(Answer))
print(*Answer)


n = int(input())
a = list(map(int, input().split()))
res = [0]
count = 0
for n in a:
	if n < 0:
		if count == 2:
			count = 0
			res.append(0)
		count += 1
	res[-1] += 1
print(len(res))
print(*res)


n = int(input())
s = list(map(int, input().split()))
r = ''
(a, b, c) = (0, 0, 0)
for i in range(n):
	if s[i] < 0:
		a += 1
	if a >= 3:
		r += str(i - b)
		r += ' '
		a = 1
		b = i
		c += 1
print(c + 1)
print(r + str(n - b))


n = int(input())
lst = list(map(int, input().split()))
k = 0
m = 0
folders = []
for i in range(n):
	if lst[i] < 0:
		k += 1
	if k == 3:
		folders.append(i - m)
		m = i
		k = 1
if m < n:
	folders.append(n - m)
print(len(folders))
for i in range(len(folders)):
	if i == len(folders) - 1:
		print(folders[i], end='\n')
	else:
		print(folders[i], end=' ')


from math import ceil
n = int(input())
reports = list(map(int, input().split()))
k = 0
count = 0
lst = []
for i in reports:
	count += 1
	if i < 0:
		if k + 1 > 2:
			lst.append(count - 1)
			count = 1
			k = 1
		else:
			k += 1
lst.append(count)
print(len(lst))
for i in lst:
	print(i, end=' ')


n = int(input())
a = [int(s) for s in input().split(' ')]
folders = []
n = 0
count = 0
for i in a:
	if n == 2 and i < 0:
		folders.append(str(count))
		count = 1
		n = 1
		continue
	if i < 0:
		n += 1
	count += 1
folders.append(str(count))
print(len(folders))
print(' '.join(folders))


k = int(input())
b = list(map(int, input().split()))
l = []
c = 0
x = 0
i = 0
while i < len(b):
	if b[i] < 0:
		c = c + 1
		if c == 3:
			c = 1
			l.append(x)
			x = 1
		else:
			x = x + 1
	else:
		x = x + 1
	i += 1
l.append(x)
print(len(l))
print(*l, sep=' ')


n = int(input())
folders = []
loss_count = 0
day_count = 0
for x in map(int, input().split()):
	if x < 0:
		if loss_count == 2:
			folders.append(day_count)
			loss_count = 1
			day_count = 0
		else:
			loss_count += 1
	day_count += 1
folders.append(day_count)
print(len(folders))
print(' '.join(map(str, folders)))


n = int(input())
a = list(map(int, input().split()))
b = []
cur = 0
while cur < n:
	cnt = 0
	size = 0
	while cur < n and cnt < 3:
		if a[cur] < 0:
			cnt += 1
		cur += 1
		size += 1
	if cnt == 3:
		cur -= 1
		size -= 1
	b.append(size)
print(len(b))
print(' '.join(map(str, b)))


n = input()
a = list(map(int, input().split()))
f = []
n = 0
c = 0
for i in a:
	if i < 0:
		n += 1
	if n == 3:
		f.append(str(c))
		c = 1
		n = 1
		continue
	c += 1
f.append(str(c))
print(len(f))
print(' '.join(f))


n = int(input())
lst = list(map(int, input().split()))
(k, res, last, length) = (0, [0], 0, 1)
for (i, x) in enumerate(lst):
	if x < 0:
		if k == 2:
			res.append(i - last)
			length += 1
			(last, k) = (i, 1)
		else:
			k += 1
res.append(n - last)
res.pop(0)
print(length)
print(*res)


input()
days = map(int, input().split())
folders = []
fc = 0
c = 0
for i in days:
	if i < 0:
		if c < 2:
			c += 1
		else:
			fc += 1
			c = 1
	if len(folders) <= fc:
		folders.append(0)
	folders[fc] += 1
print(fc + 1)
print(*folders)


n = int(input())
l = list(map(int, input().split()))
folders = [0]
cur = 0
loss = 0
for i in range(n):
	if l[i] < 0:
		loss += 1
		if loss == 3:
			folders.append(0)
			loss = 1
			cur += 1
	folders[cur] += 1
print(len(folders))
print(*folders)


import re
import itertools
from collections import Counter

class Task:
	a = []
	answer = []

	def getData(self):
		input()
		self.a = [int(x) for x in input().split(' ')]

	def solve(self):
		currentFolderCounter = 0
		badDaysCounter = 0
		for x in self.a:
			if x >= 0:
				currentFolderCounter += 1
			elif badDaysCounter <= 1:
				currentFolderCounter += 1
				badDaysCounter += 1
			else:
				self.answer += [currentFolderCounter]
				currentFolderCounter = 1
				badDaysCounter = 1
		if currentFolderCounter > 0:
			self.answer += [currentFolderCounter]

	def printAnswer(self):
		print(len(self.answer))
		print(re.sub('[\\[\\],]', '', str(self.answer)))
task = Task()
task.getData()
task.solve()
task.printAnswer()


N = int(input())
A = list(map(int, input().split()))
ans = []
ptr = 0
while ptr < N:
	s = 0
	nxt = ptr
	while nxt < N and s + (A[nxt] < 0) <= 2:
		s += A[nxt] < 0
		nxt += 1
	ans.append(nxt - ptr)
	ptr = nxt
print(len(ans))
print(*ans)


n = int(input())
a = list(map(int, input().split()))
(count, days, total, b) = (0, 0, 0, [])
for i in range(n):
	days += 1
	if a[i] < 0:
		count += 1
	if count == 3:
		total += 1
		b.append(days - 1)
		days = 1
		count = 1
else:
	print(total + 1)
	b.append(days)
	print(*b)


import sys
import math
n = int(sys.stdin.readline())
an = [int(x) for x in sys.stdin.readline().split()]
res = 0
v = []
p = 0
k = 0
for i in an:
	if i < 0:
		if p < 2:
			p += 1
		else:
			p = 1
			v.append(str(k))
			res += 1
			k = 0
	k += 1
if k != 0:
	res += 1
	v.append(str(k))
print(res)
print(' '.join(v))


n = int(input())
profit = [int(x) for x in input().split(' ')]
daysInFolders = [0]
folders = 1
badDays = 0
for elem in profit:
	if elem < 0:
		if badDays >= 0 and badDays < 2:
			badDays += 1
			daysInFolders[-1] += 1
		elif badDays == 2:
			daysInFolders.append(1)
			folders += 1
			badDays = 1
		else:
			badDays += 1
			daysInFolders[-1] += 1
	else:
		daysInFolders[-1] += 1
print(folders)
print(' '.join([str(x) for x in daysInFolders]))


P = print
I = input
I()
a = b = 0
t = []
for x in map(int, I().split()):
	if x < 0:
		if b == 2:
			t += [a]
			b = 1
			a = 0
		else:
			b += 1
	a += 1
if a:
	t += [a]
P(len(t))
for x in t:
	P(x, end=' ')


import sys
input = sys.stdin.readline

def inp_int():
	return int(input())

def inp_int_list():
	return list(map(int, input().split()))

def inp_str():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def folder_generator(_profit_list):
	folder_list = []
	threshold = 2
	cnt = 0
	for i in range(len(_profit_list)):
		if _profit_list[i] < 0:
			if threshold == 0:
				folder_list.append(str(cnt))
				threshold = 2
				cnt = 0
			threshold -= 1
		cnt += 1
		if i == len(_profit_list) - 1:
			folder_list.append(str(cnt))
			return folder_list
	return folder_list
day_num = inp_int()
profit_list = inp_int_list()
result = folder_generator(profit_list)
print(len(result))
print(' '.join(result))


n = int(int(input()))
l = list(map(int, input().split()))
neg = pos = 0
z = []
for x in range(n):
	if l[x] >= 0:
		pos += 1
	elif neg < 2:
		neg += 1
	else:
		z.append(neg + pos)
		neg = 1
		pos = 0
if neg != 0 or pos != 0:
	z.append(neg + pos)
print(len(z))
print(*z)


n = int(input())
profs = list(map(int, input().split()))
res = []
currTotal = 0
currNegs = 0
for prof in profs:
	if prof >= 0:
		currTotal += 1
	elif currNegs == 2:
		res.append(currTotal)
		currTotal = 1
		currNegs = 1
	else:
		currNegs += 1
		currTotal += 1
res.append(currTotal)
print(len(res))
print(*res)


n = int(input())
x = list(map(int, input().split()))
(ans, cur_cnt) = (0, 0)
a = []
for i in range(n):
	if x[i] < 0:
		cur_cnt += 1
	if cur_cnt == 3:
		ans += 1
		cur_cnt = 1
		if len(a) == 0:
			a.append(i)
		else:
			a.append(i - sum(a))
	if i == n - 1 and cur_cnt != 3:
		ans += 1
		a.append(i - sum(a) + 1)
if ans == 0:
	print(1)
else:
	print(ans)
if len(a) == 0:
	print(n)
else:
	print(*a)


(p, x, y, n, t) = ([], 0, 0, int(input()), list(map(int, input().split())))
for i in range(n):
	if t[i] < 0:
		x += 1
	if x == 3:
		p.append(i - y)
		x = 1
		y = i
p.append(n - y)
print(len(p))
print(' '.join((str(i) for i in p)))


n = int(input())
a = list(map(int, input().split()))
po = 0
ne = 0
no = 0
l = []
for i in range(n):
	if a[i] < 0:
		ne = ne + 1
	if a[i] >= 0:
		po = po + 1
	if ne == 2:
		l.append(po + ne)
		po = 0
		ne = 0
if len(l) > 0:
	if po > 0 and ne == 0:
		l[-1] = l[-1] + po
	if ne > 0 and po > 0:
		l.append(ne + po)
	if ne > 0 and po == 0:
		l.append(ne)
else:
	l.append(po + ne)
print(len(l))
print(*l)


input()
B = []
b = neg = 0
for a in map(int, input().split()):
	if a < 0:
		if neg > 1:
			B.append(b)
			b = neg = 0
		neg += 1
	b += 1
print(len(B) + 1)
print(*B, b)


def fun(ls, n):
	count = 0
	ans = []
	number_of_elements = 0
	for (ind, i) in enumerate(ls):
		number_of_elements += 1
		if i < 0:
			count += 1
		if count > 2:
			ans.append(number_of_elements - 1)
			count = 1
			number_of_elements = 1
		if ind == n - 1:
			ans.append(number_of_elements)
			count = 0
	print(len(ans))
	print(*ans)
n = int(input())
ls = list(map(int, input().split()))
fun(ls, n)


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().split(' ')

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	n = get_int()
	a = get_ints()
	negs = 0
	cnt = 0
	ans = []
	for i in range(n):
		cnt += 1
		if a[i] < 0:
			negs += 1
		if negs == 3:
			ans.append(cnt - 1)
			cnt = 1
			negs = 1
	ans.append(cnt)
	return ans
ans = solve_a()
print(len(ans))
print(*ans)


n = int(input())
a = list(map(int, input().split()))
k = 0
fails = 0
ans = []
for i in range(n):
	if a[i] < 0 and fails == 2:
		ans.append(k)
		k = 1
		fails = 1
	else:
		k += 1
		fails += a[i] < 0
if sum(ans) < n:
	ans.append(k)
print(len(ans))
print(' '.join(map(str, ans)))


input()
ar = list(map(int, input().split()))
nums = []
cur_minus = 0
counter = 0
for i in range(len(ar)):
	if ar[i] < 0 and cur_minus == 2:
		nums.append(str(counter))
		cur_minus = 0
		counter = 0
	if ar[i] < 0:
		cur_minus += 1
	counter += 1
if counter > 0:
	nums.append(str(counter))
print(len(nums))
print(' '.join(nums))


n = int(input())
daf = list(map(int, input().split()))
count = 0
cur_count = 0
daf_count = []
for i in range(n):
	count += 1
	if daf[i] < 0:
		if cur_count == 2:
			daf_count.append(count - 1)
			cur_count = 1
			count = 1
		else:
			cur_count += 1
daf_count.append(count)
print(len(daf_count))
print(*daf_count)


n = int(input())
reports = list(map(int, input().split()))
count = 0
i = 0
folders = 1
arr = []
pos = 0
while i < len(reports):
	if reports[i] < 0:
		count = count + 1
	pos = pos + 1
	if count == 3:
		count = 1
		folders = folders + 1
		arr.append(pos - 1)
		pos = 1
	i = i + 1
if sum(arr) != len(reports):
	arr.append(len(reports) - sum(arr))
print(folders)
print(*arr)


n = int(input())
a = list(map(int, input().split()))
folders = []
n = 0
count = 0
for i in a:
	if i < 0:
		n += 1
	if n == 3:
		folders.append(str(count))
		count = 1
		n = 1
		continue
	count += 1
folders.append(str(count))
print(len(folders))
print(' '.join(folders))


__author__ = 'Alex'
n = int(input())
a = [int(i) for i in input().split()]
(cnt1, cnt2) = [0] * 2
ans = []
for i in a:
	if i < 0:
		if cnt2 > 1:
			ans.append(cnt1)
			cnt1 = cnt2 = 0
		cnt2 += 1
	cnt1 += 1
if cnt1 > 0:
	ans.append(cnt1)
print(len(ans))
print(' '.join([str(i) for i in ans]))


n = int(input().strip())
profit = tuple(map(int, input().strip().split(' ')))
bad_cnt = 0
ans = []
x = 0
for i in range(n):
	if profit[i] < 0:
		bad_cnt += 1
	if bad_cnt == 3:
		ans.append(i - x)
		x = i
		bad_cnt = 1
ans.append(i + 1 - x)
print(len(ans))
print(' '.join(map(str, ans)))


from sys import stdin, stdout
from math import ceil
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007

def solve():
	n = inp()
	l = li()
	ans = []
	c = 0
	d = 0
	for i in range(n):
		if l[i] < 0:
			if c == 2:
				ans.append(d)
				c = 1
				d = 0
			else:
				c += 1
		d += 1
	if d:
		ans.append(d)
	pr(len(ans))
	print(*ans)
for _ in range(1):
	solve()


n = int(input())
l = list(map(int, input().split()))
(c, x) = (0, 0)
d = []
for i in range(n):
	if l[i] < 0:
		c = c + 1
		x = x + 1
		if x == 2:
			d.append(c)
			x = 0
			c = 0
	else:
		c = c + 1
if d == []:
	d.append(c)
	c = 0
if c > 0 and x == 0:
	d[-1] += c
elif c > 0 and x != 0:
	d.append(c)
print(len(d))
print(*d)


def main():
	n = int(input())
	a = [int(c) for c in input().split()]
	neg = days = 0
	res = []
	for i in range(n):
		if neg == 2 and a[i] < 0:
			res.append(days)
			neg = days = 0
		days += 1
		if a[i] < 0:
			neg += 1
	if days > 0:
		res.append(days)
	print(len(res))
	print(*res)
main()


count = int(input())
days = [int(i) for i in input().split()]
count_1 = 0
res = []
currentcount = 1
for i in range(count):
	if days[i] < 0:
		count_1 += 1
	if count_1 == 3:
		res.append(currentcount - 1)
		currentcount = 2
		count_1 = 1
	else:
		currentcount += 1
res.append(currentcount - 1)
print(len(res))
print(*res)


z = int(input())
l = list(map(int, input().rstrip().split(' ')))
count = 0
pac = 0
pac_list = []
i = 0
while i < z:
	if l[i] < 0:
		count = count + 1
	pac = pac + 1
	if count == 3:
		pac_list.append(pac - 1)
		pac = 0
		i = i - 1
		count = 0
	i = i + 1
if pac > 0:
	pac_list.append(pac)
print(len(pac_list))
for i in pac_list:
	print(i, end=' ')


n = input()
s = input().split(' ')
(rugi, jumlah, berkas) = (0, 0, [])
for (j, i) in enumerate(s):
	if int(i) < 0:
		rugi += 1
		if rugi == 3:
			rugi = 1
			berkas.append(str(jumlah))
			jumlah = 1
		else:
			jumlah += 1
	else:
		jumlah += 1
	if j == len(s) - 1:
		berkas.append(str(jumlah))
print(len(berkas), ' '.join(berkas), sep='\n')


n = int(input())
a = list(map(int, input().split()))
count = 0
ans = []
for i in range(n):
	if a[i] < 0:
		count = count + 1
	else:
		pass
	if count == 3:
		count = 1
		ans.append(i - 1)
	else:
		pass
ans.append(i)
temp = 0
k = len(ans)
print(k)
for j in range(k):
	print(ans[j] + 1 - temp, end=' ')
	temp = ans[j] + 1


n = eval(input())
import math
l = list(map(int, input().split()))
i = 0
c = 0
while i < n:
	if l[i] < 0:
		c += 1
	i += 1
d = math.ceil(c / 2)
if c == 0 or c == 1:
	print(1)
else:
	print(d)
c = 0
i = 0
s = 0
while i < n:
	if l[i] < 0:
		c += 1
	else:
		s += 1
	if c == 3:
		print(s + c - 1, end=' ')
		c = 1
		s = 0
	i += 1
if s + c != 0:
	print(s + c, end=' ')


n = int(input())
dig = list(map(int, input().split()))
flag = 0
index = 0
folder = []
for i in range(n):
	folder.append(0)
for i in dig:
	if i < 0:
		flag += 1
	if flag == 3:
		flag = 1
		index += 1
	folder[index] += 1
print(index + 1)
for i in range(index + 1):
	print(folder[i], end=' ')


n = int(input())
a = [int(x) for x in input().split()]
b = []
c = 0
for i in range(n):
	if a[i] < 0 and c <= 2:
		c += 1
	if a[i] < 0 and c == 3:
		c = 1
		b.append(i)
if n not in b:
	b.append(n)
d = []
d.append(b[0])
for i in range(1, len(b)):
	d.append(b[i] - b[i - 1])
print(len(d))
for i in d:
	print(i, end=' ')
print('')


n = int(input())
a = list(map(int, input().split()))
c = 0
f = 0
x = []
for i in range(0, n):
	if a[i] >= 0:
		c = c + 1
	elif a[i] < 0:
		f = f + 1
	if f > 2:
		f = f - 2
		x.append(c + 2)
		c = 0
x.append(c + f)
print(len(x))
for i in x:
	print(i, end=' ')


n = int(input())
a = [int(i) for i in input().split()]
b = []
t = 0
k = 0
for i in range(n):
	if a[i] < 0:
		t += 1
		if t == 3:
			b.append(i - k)
			k = i
			t = 1
b.append(n - k)
print(len(b))
for i in range(len(b)):
	print(b[i], end=' ')


n = input()
s = [int(x) for x in input().split()]
negative = 0
nums = []
cur = 0
for i in s:
	if i >= 0:
		cur += 1
	else:
		negative += 1
		if negative < 3:
			cur += 1
		else:
			nums += [cur]
			cur = 1
			negative = 1
nums += [cur]
print(len(nums))
print(' '.join([str(x) for x in nums]))


n = c = 0
r = []
for x in map(int, [*open(0)][1].split()):
	if x < 0:
		if n == 2:
			r += [c]
			n = 1
			c = 0
		else:
			n += 1
	c += 1
r += [c]
print(len(r))
print(*r)


import sys
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
n = get_int()
lst = get_int_list()
res = []
count = 0
neg = 0
for i in range(n):
	if lst[i] < 0:
		neg += 1
	count += 1
	if neg == 3:
		res.append(count - 1)
		count = 1
		neg = 1
if count > 0:
	res.append(count)
print(len(res))
print(*res)


a = int(input())
t = list(map(int, input().split()))
f = []
p = 0
for k in range(a):
	if t[k] < 0:
		p += 1
		if p == 2:
			f.append(k)
			p = 0
if len(f) > 0:
	if f[-1] + 1 < a:
		for h in range(f[-1] + 1, a):
			if t[h] < 0:
				f.append(h)
l = []
if len(f) <= 1:
	print(1)
	print(a)
else:
	for j in range(len(f)):
		if j == 0:
			l.append(f[j] + 1)
		elif j == len(f) - 1:
			l.append(a - (f[j - 1] + 1))
		else:
			l.append(abs(f[j] - f[j - 1]))
	print(len(l))
	print(*l)


import math
k = int(input())
j = list(map(int, input().split()))
c = 0
d = 0
e = 0
f = ''
for x in range(len(j)):
	if j[x] < 0:
		c += 1
		d += 1
		if d == 3:
			d = 1
			f += ' ' + str(len(j[e:x]))
			e = x
	if x == len(j) - 1:
		f += ' ' + str(len(j[e:]))
if c == 0:
	c = 2
print(math.ceil(c / 2))
print(f.strip())


t = int(input())
lst = list(map(int, input().split()))
count1 = 0
count2 = 0
count3 = 0
count = []
ans = ''
i = 0
while i != t:
	if lst[i] < 0:
		count1 += 1
		if count1 == 3:
			count1 = 0
			count2 += 1
			count.append(count3)
			count3 = -1
			i -= 1
	count3 += 1
	if i == t - 1:
		count2 += 1
		count.append(count3)
	i += 1
print(count2)
for j in range(len(count)):
	ans = ans + str(count[j]) + ' '
print(ans)


n = input()
l = list(map(int, input().split()))
r = []
con = 1
con2 = 0
for e in l:
	if e < 0:
		con2 += 1
	if con2 == 3:
		r.append(str(con - 1))
		con2 = 1
		con = 1
	con += 1
r.append(str(con - 1))
print(len(r))
print(' '.join(r))


n = int(input())
a = list(map(int, input().split()))
l = []
c = 0
file = 0
for i in a:
	if i < 0:
		c += 1
		if c == 3:
			l.append(file)
			file = 1
			c = 1
		else:
			file += 1
	else:
		file += 1
if file != 0:
	l.append(file)
print(len(l))
print(*l)


n = int(input())
arr = list(map(int, input().split()))
counter_negative = 0
current = 0
res = []
for a in arr:
	current += 1
	if a < 0:
		counter_negative += 1
	if counter_negative == 3:
		res.append(current - 1)
		current = 1
		counter_negative = 1
res.append(current)
print(len(res))
for r in res:
	print(r, end=' ')