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