#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int cur = 0;
  long long ans = 0;
  for (auto(i) = (0); (i) < (n); (i)++) {
    int asdf;
    scanf("%d", &asdf);
    ans += (abs(cur - asdf));
    cur = asdf;
  }
  cout << ans << endl;
  return 0;
}
