#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  int n;
  cin >> n;
  long long value = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    ans += abs(value - tmp);
    value = tmp;
  }
  cout << ans << endl;
  return 0;
}
