#include <stdio.h>

int main(){
  int N;
  scanf("%d\n",&N);
  int i,j;
  int a[200000];
  for(i = 2; i <= N; i++){
    scanf("%d",&a[i]);
  }
  
  int count[200000];
  for(i = 1; i <= N ; i++){
    count[i] = 0;
  }
  
  for(i = 1; i <= N ; i++){
    for(j = 2; j <= N ; j++){
      if(i == a[j])
        count[i] = count[i] + i;
    }
    printf("%d\n",count[i]);
  }
}
