#include <bits/stdc++.h>
int main() {
  int n, a[200005] = {0}, x, g = 0;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &x);
    if (a[x + 100000] == 0 && x != 0) {
      g++;
      a[100000 + x] = 1;
    }
  }
  printf("%d\n", g);
  return 0;
}
