#include "souvenirs.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(),x.end()
#define rall(x) x.begin(),x.end()
#ifdef MARCO
#define infof(str,...) do{fprintf(stderr, str"\n", ##__VA_ARGS__);}while(0);
#define infor(str,...) do{fprintf(stderr, str, ##__VA_ARGS__);}while(0);
#else
#define infof(str,...)
#define infor(str,...)
#endif
void buy_souvenirs(int N, long long P0) {
ll p0 = P0;
auto [t, m] = transaction(P0-1);
if(t.size() == 1) {
for(int i=0; i<2; i++) transaction(P0-1-m-1);
}
else {
transaction( (p0-1-m)/2 );
}
}
#ifdef MARCO
#include "souvenirs.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <utility>
#include <vector>
namespace {
const int CALLS_CNT_LIMIT = 10'000;
int calls_cnt;
int N;
std::vector<long long> P;
std::vector<int> Q;
void quit(const char* message) {
printf("%s\n", message);
exit(0);
}
} // namespace
std::pair<std::vector<int>, long long> transaction(long long M) {
calls_cnt++;
if (calls_cnt > CALLS_CNT_LIMIT)
quit("Too many calls");
if (M >= P[0] || M < P[N - 1])
quit("Invalid argument");
std::vector<int> L;
long long R = M;
for (int i = 0; i < N; i++) {
if (R >= P[i]) {
R -= P[i];
Q[i]++;
L.push_back(i);
}
}
return {L, R};
}
int main() {
assert(1 == scanf("%d", &N));
P.resize(N);
for (int i = 0; i < N; i++)
assert(1 == scanf("%lld", &P[i]));
fclose(stdin);
Q.assign(N, 0);
calls_cnt = 0;
buy_souvenirs(N, P[0]);
for (int i = 0; i < N; i++)
printf("%s%d", i ? " " : "", Q[i]);
printf("\n");
fclose(stdout);
return 0;
}
#endif