#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  cout << vec.end() - vec.begin() << endl;
}
