#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x = 0, k, o = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> k;
    o += abs(k - x);
    x = k;
  }
  cout << o << endl;
  return 0;
}
