#include <stdio.h>
#include<stdlib.h>
#include<assert.h>
typedef struct Node{
   int data;
   struct Node*next;
}Stlist;
 Stlist*new(int x) //返回一个头指针
{
    Stlist*newNode = (Stlist*)malloc(sizeof(Stlist));
    assert(newNode!=NULL);
     return newNode; 
}
int sum(Stlist*phead);
void headNode(Stlist**phead,int x);
void headNode(Stlist**phead,int x)//插入函数
{   
    Stlist*newNode = new(x);
    newNode->data = x;
    newNode->next = *phead;
     *phead = newNode;
}
int main() {
     Stlist *s = NULL;
     int input ,n;
     scanf("%d",&n);
     while(n--)
     {
        scanf("%d",&input);
        headNode(&s,input);
     }
     printf("%d",sum(s));
 
}
int sum(Stlist*phead)
{
  int sum = 0;
     Stlist*cur = phead;
     while(cur)
     {
       sum+=cur->data;
         cur = cur->next;
     }
   return sum;
}