#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
long long b[N], n, x, cnt;
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", b + i);
  for (int i = 0; i < n; ++i) cnt += abs(b[i] - x), x = b[i];
  printf("%lld\n", cnt);
  return 0;
}
