#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, m, a[N];
double dp[N][N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dp[i][j] = (a[i] > a[j]);
  for (int i = 1; i <= m; i++) {
    int t1, t2;
    scanf("%d%d", &t1, &t2);
    for (int j = 1; j <= n; j++) {
      dp[j][t1] = dp[j][t2] = (dp[j][t1] + dp[j][t2]) / 2;
      dp[t1][j] = dp[t2][j] = (dp[t1][j] + dp[t2][j]) / 2;
    }
    dp[t1][t2] = dp[t2][t1] = 0.5;
  }
  double ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += dp[i][j];
  printf("%.8lf", ans);
  return 0;
}
