#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    map<int, bool> ht;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      int temp;
      cin >> temp;
      try {
        if (!ht.at(temp)) {
          ans += 1;
        }
      } catch (out_of_range& e) {
        ans += 1;
      }
      ht[temp] = true;
    }
    cout << ans << endl;
  }
  return 0;
}
