#include <bits/stdc++.h>

using namespace std;

const int nmax = 100009;
const int mod = 1000000007;

int a[nmax] , i , n , inv[nmax] , fact[nmax] , j , answer , add , a0 , c0 , k;

void mul(int &x , int y)
{
    x = (1LL * x * y) % mod;
}

int fastpow(int x , int p)
{
    int y = 1;
    for (int i = 0 ; (1 << i) <= p ; ++i)
    {
        if ((1 << i) & p) mul(y , x);
        mul(x , x);
    }

    return y;
}

int main()
{

//freopen("test.in" , "r" , stdin);
//freopen("test.out" , "w" , stdout);

scanf("%d" , &n);

for (i = 1 ; i <= n ; ++i)
scanf("%d" , &a[i]);

fact[0] = inv[0] = 1;
for (i = 1 ; i <= n ; ++i)
{
    fact[i] = fact[i - 1] , inv[i] = inv[i - 1];
    mul(fact[i] , i);
    mul(inv[i] , fastpow(i , mod - 2));
}

sort(a + 1 , a + n + 1);

answer = 1;
for (i = 1 ; i <= n ; )
{
    a0 = a[i] , k = 0;
    while (i <= n && a0 == a[i]) k++ , i++;

    add = 0;
    for (j = 0 ; j <= k ; ++j)
    {
        c0 = 1;
        mul(c0 , fact[k]);
        mul(c0 , inv[j]);
        mul(c0 , inv[k - j]);
        mul(c0 , c0);
        add = (add + c0) % mod;
    }

    mul(answer , add);
}

answer = (answer - 1 + mod) % mod;

printf("%d\n" , answer);

return 0;
}