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