#include <bits/stdc++.h>
using namespace std;
const int M = 1010;
int n, m, rec[M];
double dp[M][M];
int main() {
  cin >> n >> m;
  int x, y;
  for (int i = 1; i <= n; i++) cin >> rec[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < i; j++)
      if (rec[i] > rec[j])
        dp[i][j] = 1, dp[j][i] = 0;
      else
        dp[i][j] = 0, dp[j][i] = 1;
  while (m--) {
    cin >> x >> y;
    dp[x][y] = dp[y][x] = 0.5;
    for (int i = 1; i <= n; i++)
      if (i != x && i != y) {
        dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) / 2;
        dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) / 2;
      }
  }
  double ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += dp[i][j];
  printf("%.6lf\n", ans);
  return 0;
}
