Game field is represented by a line of n square cells. In some cells there are packmen, in some cells there are asterisks and the rest of the cells are empty. Packmen eat asterisks.

Before the game starts you can choose a movement direction, left or right, for each packman. Once the game begins all the packmen simultaneously start moving according their directions. A packman can't change the given direction.

Once a packman enters a cell containing an asterisk, packman immediately eats the asterisk. Once the packman leaves the cell it becomes empty. Each packman moves at speed 1 cell per second. If a packman enters a border cell, the packman stops. Packmen do not interfere with the movement of other packmen; in one cell there can be any number of packmen moving in any directions.

Your task is to assign a direction to each packman so that they eat the maximal number of asterisks. If there are multiple ways to assign directions to eat the maximal number of asterisks, you should choose the way which minimizes the time to do that.

Input

The first line contains integer number n (2 ≤ n ≤ 1 000 000) — the number of cells in the game field.

The second line contains n characters. If the i-th character is '.', the i-th cell is empty. If the i-th character is '*', the i-th cell contains an asterisk. If the i-th character is 'P', the i-th cell contains a packman.

The field contains at least one asterisk and at least one packman.

Output

Print two integer numbers — the maximal number of asterisks packmen can eat and the minimal time to do it.

Examples

Input

6
*.P*P*


Output

3 4


Input

8
*...P..*


Output

1 3

Note

In the first example the leftmost packman should move to the right, the rightmost packman should move to the left. All the asterisks will be eaten, the last asterisk will be eaten after 4 seconds.
#include <bits/stdc++.h>
const int N = 1000000;
int n;
char str[N + 10];
int cdog = 0, fdog = 0, ldog = 0, cbone = 0, fbone = 0, lbone = 0;
int cntd[N + 10], cntb[N + 10];
int nxtd[N + 10], nxtb[N + 10];
int lstd[N + 10], lstb[N + 10];
int tp1[N + 10], tp2[N + 10][2];
bool dp[N + 10];
bool chk(int x) {
  memset(dp, 0, sizeof(dp));
  dp[0] = true;
  for (int i = n; i >= 0; --i) {
    if (str[i] != 'P') continue;
    int nd = lstd[std::min(i + x, n)];
    if (nd > i)
      tp1[i] = tp1[nd];
    else
      tp1[i] = i + x;
  }
  for (int i = n; i >= 0; --i) {
    if (str[i] != 'P') continue;
    int nd = lstd[std::min(i + x, n)], bd = nxtd[i + 1];
    if (!bd)
      tp2[i][0] = n + 1, tp2[i][1] = 0;
    else if (nd == bd)
      tp2[i][0] = bd - x, tp2[i][1] = i + x;
    else
      tp2[i][0] = bd - x, tp2[i][1] = tp1[nd];
  }
  for (int i = 0; i < n; ++i) {
    if (!dp[i]) continue;
    int nd = nxtd[i + 1];
    int nb = nxtb[i + 1];
    if (nd == 0 || nb == 0) break;
    if (nb < nd) {
      if (nb >= nd - x) {
        dp[nd] = true;
      }
      if (nb >= tp2[nd][0]) {
        dp[std::min(tp2[nd][1], n)] = true;
      }
    } else {
      dp[std::min(tp1[nd], n)] = true;
    }
  }
  int lst = 0;
  for (int i = n; i >= 0; --i)
    if (dp[i]) {
      lst = i;
      break;
    }
  return lst >= lbone;
}
int main() {
  scanf("%d", &n);
  scanf("%s", str + 1);
  for (int i = 1; i <= n; ++i)
    if (str[i] == 'P') {
      ++cdog;
      if (fdog == 0) fdog = i;
      ldog = i;
      cntd[i] = cntd[i - 1] + 1;
      cntb[i] = cntb[i - 1];
    } else if (str[i] == '*') {
      ++cbone;
      if (fbone == 0) fbone = i;
      lbone = i;
      cntd[i] = cntd[i - 1];
      cntb[i] = cntb[i - 1] + 1;
    } else {
      cntd[i] = cntd[i - 1];
      cntb[i] = cntb[i - 1];
    }
  if (cdog == 1) {
    if (cntb[ldog] > cbone - cntb[ldog]) {
      printf("%d %d\n", cntb[ldog], ldog - fbone);
    } else {
      printf("%d %d\n", cbone - cntb[ldog], lbone - ldog);
    }
    return 0;
  }
  printf("%d ", cbone);
  for (int i = n; i >= 0; --i) {
    if (str[i] == 'P')
      nxtd[i] = i;
    else
      nxtd[i] = nxtd[i + 1];
    if (str[i] == '*')
      nxtb[i] = i;
    else
      nxtb[i] = nxtb[i + 1];
  }
  for (int i = 1; i <= n; ++i) {
    if (str[i] == 'P')
      lstd[i] = i;
    else
      lstd[i] = lstd[i - 1];
    if (str[i] == '*')
      lstb[i] = i;
    else
      lstb[i] = lstb[i - 1];
  }
  int l = 1, r = n, ans = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (chk(mid)) {
      ans = mid, r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
