#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, ans;
int dem[2 * N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    if (a == 0)
      continue;
    else if (!dem[a + 100000]) {
      ans++;
      dem[a + 100000]++;
    }
  }
  cout << ans;
}
