#include <bits/stdc++.h>
using namespace std;
const int maxn = 220000, maxlen = 502 * 502 + 20, consta = 1050,
          maxi = consta + 4, big = 10000000, magic = 239, magic1 = 359;
const long long INF = 1000000000;
const char BLANK = '-', FULL = '#';
string s;
char aa;
long double p[maxn];
set<pair<int, int> > low;
int a[maxn], dp[maxn];
int dps[maxn][23];
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  for (int i = 1; i <= n; ++i) {
    int sm = 0;
    for (int j = 25; j >= 0; --j) {
      if ((1 << j) & i) ++sm;
      dps[i][sm] = (i >> j) << j;
    }
    for (; sm < 22; ++sm) dps[i][sm + 1] = dps[i][sm];
  }
  long long res = 0;
  dp[0] = 1;
  int wha = 0;
  while ((1 << (wha + 1)) < n) ++wha;
  low.insert(make_pair(1 << wha, 0));
  for (int i = 1; i < n; ++i) low.insert(make_pair(i, i));
  if (sum == 0) {
    for (int i = 0; i < n; ++i) printf("0\n");
    return 0;
  }
  cout << a[0] * 1 << endl;
  res = a[0] * 1;
  for (int h = 1; h + 1 < n; ++h) {
    while (low.begin()->first <= h) {
      int who = low.begin()->second;
      low.erase(low.begin());
      res -= dp[who] * a[who];
      ++dp[who];
      res += dp[who] * a[who];
      low.insert(make_pair(dps[n - who - 1][dp[who]] + who, who));
    }
    printf("%I64d\n", res);
  }
}
