#include <bits/stdc++.h>
using namespace std;
double f[1010][1010];
int a[1010];
int N, M;
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.;
  for (int _ = 1; _ <= M; ++_) {
    int x, y;
    scanf("%d%d", &x, &y);
    f[x][y] = f[y][x] = (f[x][y] + f[y][x]) / 2.;
    for (int i = 1; i <= N; ++i) {
      if (i == x || i == y) continue;
      f[i][x] = f[i][y] = (f[i][x] + f[i][y]) / 2.;
      f[x][i] = 1 - f[i][x];
      f[y][i] = 1 - f[i][y];
    }
  }
  double ans = 0;
  for (int i = 1; i <= N; ++i)
    for (int j = i + 1; j <= N; ++j) ans += f[i][j];
  printf("%.9f\n", ans);
  return 0;
}
