#include <bits/stdc++.h>
using namespace std;
int a1[100001], a2[100001];
int main() {
  int n, i, tmp, count = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    if (tmp < 0)
      a1[-(tmp)]++;
    else if (tmp >= 0)
      a2[tmp]++;
  }
  for (i = 1; i < 100001; i++)
    if (a1[i]) count++;
  for (i = 1; i < 100001; i++)
    if (a2[i]) count++;
  printf("%d\n", count);
}
