Code for USACO practice problems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
431 B

#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x;
int a = 1;
for (int i = 0; i < n; i++) {
int j;
cin >> j;
x.push_back(j);
}
sort(x.begin(), x.end());
for (unsigned int i = 0; i < x.size() - 1; i++) {
// cout << x.at(i) << " ";
if (x.at(i) < x.at(i + 1)) {
a++;
}
}
cout << a;
}