#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, x, cnt = 0;
  cin >> n;
  set<long long> prov, only;
  vector<long long> ans;
  string s;
  for (long long i = 0; i < n; ++i) {
    cin >> s;
    bool fl = (s[0] == '-');
    x = 0;
    for (int j = ((fl) ? 1 : 0); j < s.size(); ++j) {
      x = x * 10 + (s[j] - '0');
    }
    if (!fl) {
      if (prov.find(x) != prov.end() || only.find(x) != only.end()) {
        cout << -1;
        return 0;
      }
      prov.insert(x);
      only.insert(x);
    } else {
      if (prov.find(x) == prov.end()) {
        cout << -1;
        return 0;
      }
      prov.erase(x);
    }
    ++cnt;
    if (prov.empty()) {
      ans.push_back(cnt);
      cnt = 0;
      only.clear();
    }
  }
  if (!prov.empty()) {
    cout << -1;
    return 0;
  }
  cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i] << ' ';
  }
  return 0;
}
