#include <bits/stdc++.h>
using namespace std;
void hosSam() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long q[100001], w[100001];
int main() {
  hosSam();
  long long x, a, ans = 0;
  cin >> x;
  for (long long i = 0; i < x; i++) {
    cin >> a;
    if (a > 0) {
      q[a]++;
    } else if (a < 0) {
      a = abs(a);
      w[a]++;
    }
  }
  for (long long i = 1; i <= 100001; i++) {
    if (q[i] > 0) ans++;
  }
  for (long long i = 1; i <= 100001; i++) {
    if (w[i] > 0) ans++;
  }
  cout << ans << endl;
}
