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