#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long linf = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const int maxn = 5e5 + 5;
const int maxm = 30;
const double eps = 1e-6;
const double pi = acos(-1.0);
int n, a[maxn];
long long pre[maxn];
struct seg_tree {
  long long min1[maxn << 2], lazy[maxn << 2];
  int ls(int x) { return x << 1; }
  int rs(int x) { return x << 1 | 1; }
  void push_up(int p) { min1[p] = min(min1[ls(p)], min1[rs(p)]); }
  void build(int id, int l, int r) {
    lazy[id] = 0;
    if (l == r) {
      min1[id] = pre[l + n / 2] - pre[l - 1];
      return;
    }
    int mid = (l + r) >> 1;
    build(ls(id), l, mid);
    build(rs(id), mid + 1, r);
    push_up(id);
  }
  void f(int id, int l, int r, long long k) {
    lazy[id] += k;
    min1[id] += k;
  }
  void push_down(int id, int l, int r) {
    int mid = (l + r) >> 1;
    f(ls(id), l, mid, lazy[id]);
    f(rs(id), mid + 1, r, lazy[id]);
    lazy[id] = 0;
  }
  void add(int id, int l, int r, int x, int y, int k) {
    if (x > y || x > r || y < l) return;
    if (x <= l && r <= y) {
      min1[id] += k;
      lazy[id] += k;
      return;
    }
    push_down(id, l, r);
    int mid = (l + r) >> 1;
    if (x <= mid) add(ls(id), l, mid, x, y, k);
    if (y > mid) add(rs(id), mid + 1, r, x, y, k);
    push_up(id);
  }
  long long query(int id, int l, int r, int x, int y) {
    if (x > y || x > r || y < l) return inf;
    long long ans = linf;
    if (x <= l && r <= y) return min1[id];
    int mid = (l + r) >> 1;
    push_down(id, l, r);
    if (x <= mid) ans = min(ans, query(ls(id), l, mid, x, y));
    if (y > mid) ans = min(ans, query(rs(id), mid + 1, r, x, y));
    return ans;
  }
} seg;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n + 1) / 2 + 1; i++) scanf("%d", &a[i]);
  for (int i = (n + 1) / 2 + 2; i <= n; i++) a[i] = a[(n + 1) / 2 + 1];
  pre[0] = 0;
  for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + a[i];
  seg.build(1, 1, (n + 1) / 2);
  for (int i = (n + 1) / 2; i >= 1; i--) {
    if (seg.query(1, 1, (n + 1) / 2, 1, i) > 0) {
      printf("%d\n", n - i + 1);
      return 0;
    }
    seg.add(1, 1, (n + 1) / 2, 1, i, a[n]);
  }
  puts("-1");
  return 0;
}
