#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  vector<unsigned long long int> v;
  cin >> N;
  unsigned long long int max = 0;
  for (int i = 0; i < N; i++) {
    unsigned long long int tmp;
    cin >> tmp;
    v.push_back(tmp);
    if (max < tmp) max = tmp;
  }
  unsigned long long int tmp = 0;
  unsigned long long int ans = 0;
  unsigned long long int max2 = (unsigned long long int)log2(max);
  unsigned long long int num = 2;
  for (int i = 0; i <= max2; i++) {
    unsigned long long int zero = 0, one = 0;
    unsigned long long int power =
        (unsigned long long int)pow(2, i) % 1000000007;
    for (int n = 0; n < N; n++) {
      if (v[n] % 2 == 0) {
        zero++;
      } else {
        one++;
      }
      v[n] = v[n] >> 1;
    }
    ans = (ans + ((one * zero) % 1000000007) * power) % 1000000007;
  }
  cout << ans << endl;
}
