#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long long int ans = 0, temp, curr = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &temp);
    ans = ans + (int)abs(curr - temp);
    curr = temp;
  }
  printf("%lld\n", ans);
  return 0;
}
