#include <bits/stdc++.h>
using namespace std;
int Power(int base, int exp) {
  int ans = 1;
  while (exp > 0) {
    if (exp & 1) ans = (1LL * ans * base) % 1000000007;
    exp = exp >> 1;
    base = (1LL * base * base) % 1000000007;
  }
  return ans;
}
void input() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i += 1) cin >> a[i];
  vector<int> ans;
  int i = 0;
  while (i < n) {
    int j = i;
    if (a[j] < 0) {
      cout << -1 << '\n';
      return;
    }
    map<int, int> mm;
    int u = 1;
    mm[a[j]] = 1;
    j++;
    bool flag = 0;
    while (j < n) {
      if (a[j] > 0) {
        if (mm.find(a[j]) != mm.end() || mm.find(-a[j]) != mm.end()) {
          cout << -1 << '\n';
          return;
        }
        mm[a[j]] = 1;
        u++;
      } else {
        if (mm.find(-a[j]) == mm.end() || mm.find(a[j]) != mm.end()) {
          cout << -1 << '\n';
          return;
        }
        mm[a[j]] = 1;
        u--;
      }
      if (u == 0) {
        flag = 1;
        break;
      }
      j++;
    }
    if (!flag) {
      cout << -1 << '\n';
      return;
    }
    ans.push_back(j - i + 1);
    i = j + 1;
  }
  int ss = ans.size();
  cout << ss << '\n';
  for (int i = 0; i < ss; i += 1) cout << ans[i] << ' ';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  while (q--) input();
}
