#include <iostream>

#include <unordered_map>

#define MOD 1000000007

using namespace std;

long long bin_expo(long long a, long long n) {

long long ans = 1;

while (n > 0) {

if (n & 1) {

ans = (ans * a) % MOD;

}

a = (a * a) % MOD;

n >>= 1;

}

return ans % MOD;

}

long countSubsequences(int* arr, int n) {

unordered_map<int, int> freq;

for (int i = 0; i < n; i++) {

freq[arr[i]]++;

}

long ans = 0;

for (const auto& entry : freq) {

int count = entry.second;

long long subsequences = (bin_expo(2, count) - 1 + MOD) % MOD;

ans = (ans + subsequences) % MOD;

}

return ans;

}