#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[200001];
  for (int i = 0; i < 200001; i++) {
    A[i] = 0;
  }
  int n;
  cin >> n;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a != 0) {
      A[a + 100000]++;
    }
  }
  int r = 0;
  for (int i = 0; i < 200001; i++) {
    if (A[i] != 0) {
      r++;
    }
  }
  cout << r << endl;
}
