#include <stdio.h>
#include <stdlib.h>
struct node {
    int num;
    struct node* next;
};
int main() {
    int n, i;
    scanf("%d", &n);
    int a[n];
    struct node* head = (struct node*)malloc(sizeof(struct node));//创建一个头指针
    struct node* p = head;//保存头指针的地址
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);//输入数组元素
        head->next = (struct node*)malloc(sizeof(struct node));//创造节点
        head->next->num = a[i];//节点一次存放数组值
        head = head->next;//使头指针指向下一个节点
        if (i == n - 1) head->next = NULL;//最后一个元素输入完毕,初始化指针
    }
    head = p;//让头指针重新指向链表的头,因为前面头指针移动了
    int sum = 0;
    while (p->next) {
        sum += p->next->num;//累加链表中各个节点的值即可
        p = p->next;
    }
    printf("%d", sum);
    return 0;
}