#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007, con = 2500000;
long long n, k, a, ans;
int main() {
  iostream::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> k;
    ans += abs(a - k);
    a = k;
  }
  cout << ans;
  return 0;
}
