#include<iostream>
#include<vector>
int main(){
  int N;
  std::cin >> N;
  std::vector<int>a(N);//cin
  for(int i = 0; i < N; i++){
    int b;
    std::cin >> b;
    a.push_back(b);
  }
  int step=0;
  std::vector<int>c;//diff
  std::vector<int>d;//after
  d.push_back(a[0]);
  for(int j = 1; j < N; j++){
    if(a[j-1]<=a[j]){
      c.push_back(0);
      d.push_back(a[j]);
    }
    else if(a[j-1]>a[j]){
      c.push_back(std::abs(a[j]-d[j-1]));
      d.push_back(a[j]+std::abs(a[j]-d[j-1]));
    }
    int k;
    int sum=0;
    for(k=0;k<N;k++){
      sum=sum+c[k];
    }
    std::cout << sum << std::endl;
  }