#include <bits/stdc++.h>
using namespace std;
double f[1001][1001];
double g[1001][1001];
int n, m;
int a[1001];
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++) f[i][j] = a[i] > a[j] ? 1 : 0;
  for (int i = 1; i <= m; i++) {
    int k1, k2;
    double p = 0.5;
    scanf("%d%d", &k1, &k2);
    for (int j = 1; j <= n; j++)
      if (j != k1 && j != k2) {
        f[j][k2] = f[j][k1] = (f[j][k2] + f[j][k1]) * p;
        f[k1][j] = f[k2][j] = 1 - f[j][k2];
      }
    f[k1][k2] = f[k2][k1] = (f[k1][k2] + f[k2][k1]) * p;
  }
  double t = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) t += f[i][j];
  printf("%.8lf\n", t);
  return 0;
}
