#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, ax, ax1 = 0;
  cin >> n;
  vector<int> V;
  for (int i = 0; i < n; i++) {
    cin >> k;
    if (k != 0) {
      V.push_back(k);
    }
  }
  if (V.size() == 0) {
    cout << 0;
    return 0;
  }
  sort(V.begin(), V.end());
  ax = -1;
  for (int i = 0; i < V.size(); i++) {
    if (V[i] == ax) {
      V[i] = 0;
    } else {
      ax = V[i];
    }
  }
  for (int i = 0; i < V.size(); i++) {
    if (V[i] == 0) {
      continue;
    } else {
      ax1++;
    }
  }
  cout << ax1;
}
