#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[200009];
  int n;
  cin >> n;
  long long s = 0;
  for (int c = 0; c < n; c++) {
    cin >> a[c];
  }
  s = abs(a[0]);
  for (int c = 1; c < n; c++) {
    s = s + abs(a[c] - a[c - 1]);
  }
  cout << s;
  return 0;
}
