#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100010];
  vector<int> hasht(200020, 0);
  int dist = 0;
  for (int i(0); i < (n); i++) {
    cin >> a[i];
    if (hasht[a[i] + 100000] == 0 && a[i] != 0) {
      hasht[a[i] + 100000] = 1;
      dist++;
    } else {
      hasht[a[i] + 100000] = 1;
    }
  }
  cout << dist;
  return 0;
}
