#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, num = 0, c = 0, ara[100001];
  scanf("%I64d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &ara[i]);
  }
  sort(ara, ara + n);
  for (int i = 0; i < n; i++) {
    if (ara[i] == 0) {
      continue;
    }
    ara[i] += num;
    if (ara[i] != 0) {
      num += (-1) * ara[i];
      c++;
    }
  }
  printf("%I64d\n", c);
}
