#include <bits/stdc++.h>
using namespace std;
const int N = 2145;
int n, m, a[N];
double f[N][N], kkr;
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[j] > a[i];
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &x, &y);
    for (int j = 1; j <= n; j++) {
      f[j][x] = f[j][y] = 0.5 * (f[j][x] + f[j][y]);
      f[x][j] = f[y][j] = (double)1.0 - f[j][x];
    }
    f[x][y] = f[y][x] = 0.5;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) kkr += f[j][i];
  }
  printf("%.10lf", (double)kkr);
}
