#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j;
  cin >> n;
  long long ar[n + 1];
  for (i = 1; i <= n; i++) cin >> ar[i];
  long long cont = 0;
  for (i = 1; i < n; i++) {
    for (j = 17;; j--) {
      long long x = i + pow(2, j);
      if (x <= n) {
        ar[x] = ar[x] + ar[i];
        cont = cont + ar[i];
        cout << cont << endl;
        break;
      }
    }
  }
  return 0;
}
