#include <bits/stdc++.h>
using namespace std;
class abc {
 public:
  long long int x, y;
};
long long int ss1(vector<long long int> arr, long long int n) {
  long long int sum = 0;
  for (long long int i = 0; i < 61; i++) {
    long long int zc = 0, oc = 0;
    long long int idsum = 0;
    for (long long int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (((oc % 1000000007) * (zc % 1000000007)) % 1000000007 *
             ((long long int)(pow(2, i))) % 1000000007) %
            1000000007;
    sum += idsum % 1000000007;
    sum %= 1000000007;
  }
  return sum;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long int> arr(n);
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long int sum = ss1(arr, n) % 1000000007;
  cout << sum << "\n";
}
