#include <bits/stdc++.h>
using namespace std;
const int B = 20;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < int(n); i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 0; i < int(n - 1); i++) {
    if (a[i] > 0) {
      int t = B;
      while (i + (1 << t) >= n) {
        --t;
      }
      int take = a[i];
      ans += take;
      a[i] -= take;
      a[i + (1 << t)] += take;
    }
    cout << ans << "\n";
  }
}
