#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > vc(n);
  long long num = 0;
  for (int i = 0; i < n; i++) {
    cin >> num;
    bitset<62> temp(num);
    vector<int> array(62);
    for (int j = 0; j < 61; j++) {
      array[j] = int(temp[j]);
    }
    vc[i] = array;
  }
  long long ans = 0;
  long long count = 0;
  for (int i = 0; i < 62; i++) {
    long long count = 0;
    for (long long j = 0; j < n; j++) {
      if (vc[j][i] == 1) {
        count++;
      }
    }
    num = 1 << i;
    num = num % 1000000007;
    long long num2;
    num2 = count * (n - count) % 1000000007;
    ans += (num2 * num) % 1000000007;
    ans = ans % 1000000007;
  }
  ans = ans % 1000000007;
  cout << ans << endl;
}
