#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const int MOD = 1000000007;
int Arr[200007];
int main(int argc, const char **argv) {
  int N;
  long long Res = 0;
  while (~scanf("%d", &N)) {
    Res = 0;
    for (int i = 1; i <= N; ++i) {
      scanf("%d", Arr + i);
      Res += abs(Arr[i] - Arr[i - 1]);
    }
    printf("%lld\n", Res);
  }
  return 0;
}
