#include <bits/stdc++.h>
long int pos[100001] = {0}, neg[100001] = {0};
int main() {
  long int n, count = 0, i;
  scanf("%ld", &n);
  long int arr[n];
  for (i = 0; i < n; i++) {
    scanf("%ld", arr + i);
    if (arr[i] > 0)
      pos[arr[i]]++;
    else if (arr[i] < 0)
      neg[-arr[i]]++;
  }
  for (i = 0; i < 100001; i++) {
    if (pos[i] > 0) count++;
    if (neg[i] > 0) count++;
  }
  printf("%ld", count);
  return 0;
}
