#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a, rez;
  int n;
  cin >> n;
  if (n == 1) return 0;
  a.resize(n);
  rez.assign(n, 0);
  for (int i = 0; i < n; ++i) cin >> a[i];
  if (n == 2) {
    cout << a[0] << "\n";
    return 0;
  }
  int t = (int)(log10((n - 1) / 1.0) / log10(2.0));
  rez[0] = a[0];
  for (int i = 0; i < n - 2; ++i) {
    if (i + (2 << (t - 1)) > n - 1) --t;
    if (i != 0) rez[i] = a[i] + rez[i - 1];
    while (a[i] != 0) {
      --a[i];
      ++a[i + (2 << (t - 1))];
    }
  }
  rez[n - 2] = a[n - 2] + rez[n - 3];
  for (int i = 0; i < n - 1; ++i) cout << rez[i] << "\n";
  return 0;
}
