#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    int N;
    cin >> N;
    unordered_map<int, int> m;
    for (int j = 0; j < N; j++) {
      int elem;
      cin >> elem;
      m[elem] = 1;
    }
    cout << m.size() << endl;
  }
}
