#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int a, diff = 0, temp = 0, sum = 0;
  while (n--) {
    cin >> a;
    sum += fabs(temp - a);
    temp = a;
  }
  cout << sum;
  return 0;
}
