#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, sum, x, y;
  sum = y = 0;
  cin >> t;
  while (t--) {
    cin >> x;
    sum += abs(x - y);
    y = x;
  }
  cout << sum << endl;
  return 0;
}
