#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int n;
int a[maxn], vis[maxn * 2];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    if (a[i] != 0) a[i] += maxn;
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] != 0) {
      if (vis[a[i]] == 0) ans++, vis[a[i]] = 1;
    }
  printf("%d", ans);
  return 0;
}
