#include <bits/stdc++.h>
using namespace std;
int *p;
int n;
int main() {
  cin >> n;
  p = new int[n];
  for (int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    while (p[i] > 0) {
      int t = log2(n);
      while (i + (2 << t) >= n && t) t--;
      p[i]--;
      p[i + (2 << t)]++;
      ans++;
    }
    cout << ans << endl;
  }
}
