#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int d = 0;
  vector<int> as(n);
  for (int i = 0; i < n; i++) {
    cin >> as.at(i);
    if (i == 0) {
      continue;
    } else {
      d += abs(as.at(i - 1) - as.at(i));
    }
  }
  cout << d << endl;
}
