#include <bits/stdc++.h>
using namespace std;
int a[1500];
double dp[1500][1500];
int main() {
  int n, m;
  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++)
      if (a[i] > a[j]) dp[i][j] = 1;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    for (int j = 0; j < n; j++)
      if (j != x && j != y) {
        dp[j][x] = dp[j][y] = 0.5 * dp[j][x] + 0.5 * dp[j][y];
        dp[x][j] = 1 - dp[j][x];
        dp[y][j] = 1 - dp[j][y];
      }
    dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * 0.5;
  }
  double ans = 0.0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) ans += dp[j][i];
  printf("%.10lf\n", ans);
  return 0;
}
