#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define AC "test"
#define foru(i, l, r) for (int i = (l); i <= (r); i++)
#define ford(i, l, r) for (int i = (l); i >= (r); i--)
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
const ll inf = 1e9 + 7;
const ll linf = 1e18 + 7;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 7;
const int base = 31;
void fastIO(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
}
ll mul(ll a, ll b){
a%=mod;
ll res = 0;
while (b){
if (b%2) res = (res + a)%mod;
a = (a + a)%mod;
b/=2;
}
return res;
}
ll Pow(ll a, ll b){
ll ans = 1;
while (b){
if (b % 2) ans = mul(ans, a);
a = mul(a, a);
b/=2;
}
return ans;
}
int getup[maxn], getdown[maxn], n, a[maxn], b[maxn], up[maxn], down[maxn], ansup, ansdown, cntup[maxn], cntdown[maxn], posup[maxn], posdown[maxn], res, cnt;
void inp(){
cin >> n;
foru(i, 1, n){
cin >> a[i];
b[i] = inf - a[i];
}
cntup[0] = cntdown[0] = 1;
up[1] = 0;
down[1] = 0;
ansup = 0;
ansdown = 0;
ford(i, n, 1){
int it = lower_bound(up + 1, up + ansup + 1, a[i]) - up;
up[it] = a[i];
if (it >= ansup){
ansup = it;
cntup[it] = cntup[it - 1];
}
else cntup[it] += cntup[it - 1];
getup[i] = cntup[it - 1];
posup[i] = it;
it = lower_bound(down + 1, down + ansdown + 1, b[i]) - down;
down[it] = b[i];
if (it >= ansdown){
ansdown = it;
cntdown[it] = cntdown[it - 1];
}
else cntdown[it] += cntdown[it - 1];
getdown[i] = cntdown[it - 1];
posdown[i] = it;
}
foru(i, 1, n){
res = max(res, posup[i] + posdown[i]);
}
cout << res - 1 << " ";
foru(i, 1, n){
if (posup[i] + posdown[i] == res){
cnt = ((cnt % mod) + mul(getup[i], getdown[i]))%mod;
}
}
cout << mul(Pow(2, n - res + 1), cnt);
}
int main(){
fastIO();
if (fopen(AC".inp", "r")){
freopen(AC".inp", "r", stdin);
freopen(AC".out", "w", stdout);
}
inp();
}