#include <bits/stdc++.h>
using namespace std;
int n, m, a[1010], x, y;
double dp[1010][1010];
int main(int argc, char const *argv[]) {
  for (int i = 0; i < 1010; i++)
    for (int j = 0; j < 1010; j++) dp[i][j] = 0.0;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) dp[i][j] = a[i] > a[j];
  while (m--) {
    scanf("%d%d", &x, &y);
    x--, y--;
    dp[x][y] = dp[y][x] = 0.5;
    for (int i = 0; i < n; i++)
      if (i != x && i != y) {
        dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) / 2.0;
        dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) / 2.0;
      }
  }
  double ans = 0.0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) ans += dp[i][j];
  printf("%.15lf\n", ans);
  return 0;
}
