#include <bits/stdc++.h>
using namespace std;
map<int, int> k;
map<long long, int>::iterator it;
int a[100005];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int x, k = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      if (x != 0) a[k++] = x;
    }
    sort(a, a + k);
    int m = unique(a, a + k) - a;
    printf("%d\n", m);
  }
  return 0;
}
