#include<stdio.h> typedef struct node * Node; struct node { int val; Node next; }; int main(void) { int n, m, sum = 0; scanf("%d",&n); Node head, ptr1, ptr2; head = (Node)malloc(sizeof(struct node)); head->next = NULL; head->val = -1; ptr1 = head; for(int i = 0; i < n; i++) { scanf("%d",&m); ptr2 = (Node)malloc(sizeof(struct node)); ptr2->next = NULL; ptr2->val = m; ptr1->next = ptr2; ptr1 = ptr2; } ptr1 = head->next; while(ptr1) { sum = sum + ptr1->val; ptr1 = ptr1->next; } printf("%d",sum); return 0; }