#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n = 0;
  cin >> n;
  int a[n], res[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    res[i] = 0;
  }
  for (int i = 0; i < n - 1; i++) {
    if (i) res[i] = res[i - 1];
    while (a[i]) {
      int t = 0;
      for (t = 0; i + (1 << t) < n; t++)
        ;
      t--;
      a[i]--;
      a[i + (1 << t)]++;
      res[i]++;
    }
  }
  for (int i = 0; i < n - 1; i++) cout << res[i] << '\n';
  return 0;
}
