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