title: Number of Crossings in bipartite graph
body: <p>In a bipartite graph, there are n nodes on the left and m nodes on the right. Nodes are ordered from 1 to n and 1 to m. A node on the left is connected to the node on the right. All the nodes are not connected. For eg:</p>
  
  <pre><code>1 is connected to 4
  
  2 is connected to 3
  
  3 is connected to 2
  
  3 is connected to 1
  </code></pre>
  
  <p>I want to know how many crossings are there in the graph( Here 5 crossings) . A similar problem is there on <a href="http://www.spoj.pl/problems/MSE06H/" rel="nofollow">SPOJ</a> </p>
  
  <p>I want to know how this problem can be solved by using a Binary Index Tree as some users have mentioned. I am solving with O(n^2) algo and getting TLE. </p>
  
  <p>This is not a homework. Yesterday I learned BIT and was searching for some problems so I came across this. Just tell me the trick. Please don't write the whole program.</p>